List of usage examples for javax.swing JSeparator JSeparator
public JSeparator()
From source file:Main.java
public static void main(String[] argv) throws Exception { JMenu menu = new JMenu("Menu Label"); JMenuItem item1 = new JMenuItem("Item Label"); menu.add(item1);// w w w . j a v a2 s.c o m // Add separator menu.add(new JSeparator()); // Add another menu item JMenuItem item2 = new JMenuItem("Item Label"); menu.add(item2); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JSeparator Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new GridLayout(0, 1)); JLabel above = new JLabel("Above Separator"); f.add(above);/*w w w . j a va 2 s. com*/ JSeparator separator = new JSeparator(); f.add(separator); JLabel below = new JLabel("Below Separator"); f.add(below); f.setSize(300, 100); f.setVisible(true); }
From source file:Main.java
public static void addSeparator(JPanel panel, String text) { JLabel l = createLabel(text); l.setForeground(LABEL_COLOR);/* w ww . j ava2 s. co m*/ panel.add(l, "gapbottom 1, span, split 2, aligny center"); panel.add(configureActiveComponent(new JSeparator()), "gapleft rel, growx"); }
From source file:Main.java
public static JSeparator createSeparator() { return new JSeparator(); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); bar.add(menu);//from ww w . j a va 2 s. co m menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new JMenuItem("Exit"), 0); setJMenuBar(bar); add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); bar.add(menu);/*from ww w . ja v a2s.c o m*/ menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new JMenuItem("Exit")); setJMenuBar(bar); add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); }
From source file:MenuSeparator.java
public MenuSeparator() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); bar.add(menu);// ww w. ja v a2s.c om menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new JMenuItem("Exit")); setJMenuBar(bar); getContentPane().add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); bar.add(menu);/*w ww . j ava 2s. co m*/ menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new AbstractAction("Exit") { @Override public void actionPerformed(ActionEvent arg0) { System.out.println("action"); } }); setJMenuBar(bar); add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT; menu.applyComponentOrientation(ori); bar.add(menu);// w w w.j av a 2s . com menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new JMenuItem("Exit")); setJMenuBar(bar); add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); menu.doClick(100); }
From source file:Main.java
public Main() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu("File"); ComponentOrientation ori = ComponentOrientation.LEFT_TO_RIGHT; menu.applyComponentOrientation(ori); bar.add(menu);/*from w w w . j av a 2 s . c o m*/ menu.add(new JMenuItem("Close")); menu.add(new JSeparator()); // SEPARATOR menu.add(new JMenuItem("Exit")); setJMenuBar(bar); add(new JLabel("A placeholder")); pack(); setSize(300, 300); setVisible(true); System.out.println(menu.getDelay()); }