jseparator

How to change the color of a JSeparator?

筅森魡賤 提交于 2019-12-13 12:06:49
问题 The question is in the title. I'm currently doing something like: jSperator = new JSeparator(); jSeparator1.setForeground(new java.awt.Color(255, 51, 51)); But the separator keep his default color, something like 212,212,212. 回答1: have to change ’Background’ instead of ’Foreground’ logics could be different for Nimbus Look and Feel Metal L&F import javax.swing.*; import java.awt.*; public class GridBagSeparator1 { public static void main(String[] args) { JFrame frame = new JFrame("Laying Out

JSeperator in JToolBar moves the components to right end

守給你的承諾、 提交于 2019-12-11 03:12:13
问题 I am looking at Oracle's JToolBar code and trying to add JLabels within that toolbar. I have simulated the button-like feel for them by overriding the mouse events. It worked fine until I tried to add a JSeperator as I wanted a vertical line. I have added a separator after 3 JLabels causing the rest of them to get moved to the right end as shown below. I have tried adding the addSeparator() just before and after the JSeparator code , but still no luck. Code import javax.swing.JToolBar; import

jSeparator looks - Preview Design vs Run File (netbeans)

北城余情 提交于 2019-12-11 02:58:36
问题 I have this little problem. I'm using Netbeans. When I click on Preview Design I see the jSeparators like this: But when I run the project this is what it looks like: How can I fix this problem? I want the project to look like the Preview Design. Thanks! 回答1: When you run your window ( JFrame , JDialog ) / component ( JPanel ) in Preview Design it's displayed using system look and feel, but when you run your application UIManager uses a cross-platform L&F by default, also called Metal L&F. I

Adding a vertical separator in PopupMenu, in the task bar

最后都变了- 提交于 2019-12-04 21:42:48
问题 How can I add a vertical separator in the pop up menu of the app in the task bar ? tray = SystemTray.getSystemTray(); openMenuItem = new MenuItem("Open P"); stopKLMenuItem = new MenuItem("Stop"); exitMenuItem = new MenuItem("exit"); menu.add(exitMenuItem); menu.add(stopKLMenuItem); menu.addSeparator(); // adds a horizontal separator menu.add(openMenuItem); trayIcon = new TrayIcon(image,"P",menu); The statement menu.addSeparator() adds a horizontal separator. I also wanted a vertical separator

How to change the color of a JSeparator?

心不动则不痛 提交于 2019-12-04 05:03:26
The question is in the title. I'm currently doing something like: jSperator = new JSeparator(); jSeparator1.setForeground(new java.awt.Color(255, 51, 51)); But the separator keep his default color, something like 212,212,212. have to change ’Background’ instead of ’Foreground’ logics could be different for Nimbus Look and Feel Metal L&F import javax.swing.*; import java.awt.*; public class GridBagSeparator1 { public static void main(String[] args) { JFrame frame = new JFrame("Laying Out Components in a Grid"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSeparator sep = new

How do I add a separator to a JComboBox in Java?

会有一股神秘感。 提交于 2019-12-03 09:27:05
问题 I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. In this case I would like to show the most-used-fonts at the top, then a separator and finally all font-families below the separator in alphabetical order. Can anyone help me with how to do this or is this not possible in Java

How do I add a separator to a JComboBox in Java?

孤人 提交于 2019-12-02 23:39:59
I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. In this case I would like to show the most-used-fonts at the top, then a separator and finally all font-families below the separator in alphabetical order. Can anyone help me with how to do this or is this not possible in Java? There is a pretty short tutorial with an example that shows how to use a custom ListCellRenderer on

how to get colored line to differentiate text field array in swing

孤街浪徒 提交于 2019-12-02 03:27:45
问题 I have developed one frame on which I used GridBagLayout to arrange textfields of 12X12. i.e., total 144 textfields on frame. Now I want to differentiate these text fields with colored line after each 3 columns and three rows as shown in the following diagram. I tried in many ways, but I couldn't find the solution. Please suggest. Below is the some part of my code. Thanks in advance. 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 | | | 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12 | | | 1 2 3 | 4 5 6 | 7 8 9 | 10 11 12