is there any layout manager or some other way to add a label or any other component starting from a specific point like we draw rectangles i need this because i want to move the label around with input.
gauravk_bhanot
0
Newbie Poster
Recommended Answers
Jump to PostTurn the layout manager off by setting the layout manager to null.
Then you can position components yourself.
Jump to PostThe following code may help you where clicking mouse may relocate the label.
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MovingLabel extends JFrame{ int x,y; // define the location of a label JLabel label; // movable label Container container; MovingLabel(){ super("Test a movable label"); x=y=100; label= …
All 5 Replies
Euphemia
0
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
tong1
22
Posting Whiz
new_programmer
0
Junior Poster in Training
gauravk_bhanot
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.