Reputation: 12484
I made a GIF of my situation:
Forgive the speed of it, I made it too fast
I thought that there was a function like repaint() or such? Is there a way to keep the buttons always fixed?
Here's where I add Buttons:
guiFrame.add(but2, BorderLayout.LINE_START);
guiFrame.add(but, BorderLayout.CENTER);
guiFrame.add(but3, BorderLayout.LINE_END);
guiFrame.add(combo2, BorderLayout.NORTH);
guiFrame.setVisible(true);
Here's my code, alternatively here
thanks
Upvotes: 2
Views: 160
Reputation: 15418
Put your JTextArea inside a JScrollPane
and add the scroll pane to your frame's content pane:
textArea = new JTextArea(5, 20);
JScrollPane scrollPane = new JScrollPane(textArea);
getContentPane().add(scrollPane, BorderLayout.CENTER);
Put your three buttons inside another JPanel
: buttonPanel
with suitable layout manager
. Add this buttonPanel
to the frame's content pane with BorderLayout.PAGE_END
getContentPane().add(buttonPanel, BorderLayout.PAGE_END);
Upvotes: 4
Reputation: 109813
I thought that there was a function like repaint() or such? Is there a way to keep the buttons always fixed?
everything depends of used LayoutManager
, for better help sooner post an SSCCE, short, runnable, compilable, caused a.m. issue
put floating JComponent
to JScrollPane
Upvotes: 3