This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How to add scrollbar to panel ?
I'm trying to draw some shapes on a jPanel, once the shapes reach the panel size, the rest of shapes are not visibles.
can I add a scrollbar to the panel in order to see the rest of the shapes?
Sure: wrap your JPanel into a JScrollPane (it takes any Component in its constructor)
Related
This question already exists:
UIManager.getDefaults().put() doesn´t work with colors
Closed 6 years ago.
favorite
I have a GUI with a JTabbedPane, and I want to change its Layout. I tried to do this with the UIManager:
UIManager.getDefaults().put("TabbedPane.foreground",Color.BLACK);
However, the color does not change, but when I change for example the border insets
UIManager.getDefaults().put("TabbedPane.contentBorderInsets", new Insets(0,0,0,0));
it works, but everything which needs a color doesn´t work!
The LAF from my GUI is UIManager.getSystemLookAndFeelClassName()
Use JTabbedPane.setForegroundAt():
https://docs.oracle.com/javase/7/docs/api/javax/swing/JTabbedPane.html#setForegroundAt(int,%20java.awt.Color)
This question already has answers here:
How to make JTextArea Stick to the window
(2 answers)
Closed 8 years ago.
I am designing a frame in java swing, which has 2 buttons on the end as I resize the window the gap between buttons are spread and they go far.
Please provide me solution as i want buttons to be in the bottom corner and the frame is resized the spaces should not increase.
Put the buttons in a right aligned flow layout, then add the flow layout (the panel) to the page end of a border layout.
This question already has answers here:
How do I change JPanel inside a JFrame on the fly?
(14 answers)
Clear components of JFrame and add new components
(2 answers)
Closed 8 years ago.
I am working on a 15 puzzle.
I need to change the JPanel in the JFrame for a new game.
The reason is that some games have 16 buttons while others have 9 or 25. Sometimes the buttons have a number, but sometimes they have pieces of a picture.
I would like to set up my JPanel, then set it into the JFrame.
The only way that I have been able to achieve this so far is to create a new JFrame, but that outputs a new window.
Is it possible to change the JPanel in the JFrame in java?
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Java swing Table transparency
It is not so easy to make a JTable background transparent. I want to see only the text content of my cells.
The table will be transparent if neither itself nor the cells are opaque:
table.setOpaque(false);
((DefaultTableCellRenderer)table.getDefaultRenderer(Object.class)).setOpaque(false);
If the table is in a ScrollPane, it is to make transparent as well:
scrollPane.setOpaque(false);
scrollPane.getViewport().setOpaque(false);
At least, you can remove the grid lines:
table.setShowGrid(false);
Quite a big work for a simply result...
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Making a JPanel manually resizable
I am doing a chat program with javaswing and I would like to create a separator that can adjust the dimension of 2 pannels "
The black line could reduce the height of the top panel and increase the bottom one.
How this is possiblle ? What layout sould I use ? Thank you very much.
Regards.
Try JSplitPane.
How to use SplitPanes?
Examples of JSplitPane