List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:iqq.app.ui.renderer.node.BuddyNode.java
public BuddyNode(IMBuddy buddy) { super(buddy); this.buddy = buddy; // ?/*from www . j av a2 s . c o m*/ avatarImage = new WebDecoratedImage(); avatarImage.setShadeWidth(1); avatarImage.setRound(4); avatarImage.setDrawGlassLayer(false); // nickLbl = new WebLabel(); signLbl = new WebLabel(); nickLbl.setFontSize(14); signLbl.setFontSize(13); signLbl.setForeground(Color.GRAY); GroupPanel textGroup = new GroupPanel(0, false, nickLbl, signLbl); textGroup.setMargin(0, 5, 0, 5); view.add(avatarImage, BorderLayout.WEST); view.add(new CenterPanel(textGroup, false, true), BorderLayout.CENTER); view.setMargin(5); }
From source file:Main.java
public Main() { setLayout(new BorderLayout()); model = new DefaultListModel(); list = new JList(model); JScrollPane pane = new JScrollPane(list); JButton addButton = new JButton("Add Element"); JButton removeButton = new JButton("Remove Element"); for (int i = 0; i < 15; i++) model.addElement("Element " + i); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { model.addElement("Element " + counter); counter++;//from w ww .j a v a2s . c om } }); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (model.getSize() > 0) model.removeElementAt(0); } }); add(pane, BorderLayout.NORTH); add(addButton, BorderLayout.WEST); add(removeButton, BorderLayout.EAST); }
From source file:CommonLayouts.java
public CommonLayouts() { super("Common Layout Managers"); setSize(500, 380);//www. j a v a 2 s . c o m JPanel desktop = new JPanel(); getContentPane().add(desktop); JPanel fr1 = new JPanel(); fr1.setBorder(new TitledBorder("FlowLayout")); fr1.setLayout(new FlowLayout()); fr1.add(new JButton("1")); fr1.add(new JButton("2")); fr1.add(new JButton("3")); fr1.add(new JButton("4")); desktop.add(fr1, 0); JPanel fr2 = new JPanel(); fr2.setBorder(new TitledBorder("GridLayout")); fr2.setLayout(new GridLayout(2, 2)); fr2.add(new JButton("1")); fr2.add(new JButton("2")); fr2.add(new JButton("3")); fr2.add(new JButton("4")); desktop.add(fr2, 0); JPanel fr3 = new JPanel(); fr3.setBorder(new TitledBorder("BorderLayout")); fr3.add(new JButton("1"), BorderLayout.NORTH); fr3.add(new JButton("2"), BorderLayout.EAST); fr3.add(new JButton("3"), BorderLayout.SOUTH); fr3.add(new JButton("4"), BorderLayout.WEST); desktop.add(fr3, 0); JPanel fr4 = new JPanel(); fr4.setBorder(new TitledBorder("BoxLayout - X")); fr4.setLayout(new BoxLayout(fr4, BoxLayout.X_AXIS)); fr4.add(new JButton("1")); fr4.add(Box.createHorizontalStrut(12)); fr4.add(new JButton("2")); fr4.add(Box.createGlue()); fr4.add(new JButton("3")); fr4.add(Box.createHorizontalGlue()); fr4.add(new JButton("4")); desktop.add(fr4, 0); JPanel fr5 = new JPanel(); fr5.setBorder(new TitledBorder("BoxLayout - Y")); fr5.setLayout(new BoxLayout(fr5, BoxLayout.Y_AXIS)); fr5.add(new JButton("1")); fr5.add(Box.createVerticalStrut(10)); fr5.add(new JButton("2")); fr5.add(Box.createGlue()); fr5.add(new JButton("3")); fr5.add(Box.createVerticalGlue()); fr5.add(new JButton("4")); desktop.add(fr5, 0); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:ListModelExample.java
public ListModelExample() { setLayout(new BorderLayout()); model = new DefaultListModel(); list = new JList(model); JScrollPane pane = new JScrollPane(list); JButton addButton = new JButton("Add Element"); JButton removeButton = new JButton("Remove Element"); for (int i = 0; i < 15; i++) model.addElement("Element " + i); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { model.addElement("Element " + counter); counter++;/*from www. j a v a 2s . c o m*/ } }); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (model.getSize() > 0) model.removeElementAt(0); } }); add(pane, BorderLayout.NORTH); add(addButton, BorderLayout.WEST); add(removeButton, BorderLayout.EAST); }
From source file:Main.java
public Main() { super();/* w w w . java 2s. c o m*/ setSize(300, 100); progressBar.setMinimum(minValue); progressBar.setMaximum(maxValue); progressBar.setStringPainted(true); JButton start = new JButton("Start"); start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread runner = new Thread() { public void run() { counter = minValue; while (counter <= maxValue) { Runnable runme = new Runnable() { public void run() { progressBar.setValue(counter); } }; SwingUtilities.invokeLater(runme); counter++; try { Thread.sleep(100); } catch (Exception ex) { } } } }; runner.start(); } }); getContentPane().add(progressBar, BorderLayout.CENTER); getContentPane().add(start, BorderLayout.WEST); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); }
From source file:Main.java
public Main() { super("Demostrating BoxLayout"); final int SIZE = 3; Container c = getContentPane(); c.setLayout(new BorderLayout(30, 30)); Box boxes[] = new Box[4]; boxes[0] = Box.createHorizontalBox(); boxes[1] = Box.createVerticalBox(); boxes[2] = Box.createHorizontalBox(); boxes[3] = Box.createVerticalBox(); for (int i = 0; i < SIZE; i++) boxes[0].add(new JButton("boxes[0]: " + i)); for (int i = 0; i < SIZE; i++) { boxes[1].add(Box.createVerticalStrut(25)); boxes[1].add(new JButton("boxes[1]: " + i)); }//from www .j a v a2s . c om for (int i = 0; i < SIZE; i++) { boxes[2].add(Box.createHorizontalGlue()); boxes[2].add(new JButton("boxes[2]: " + i)); } for (int i = 0; i < SIZE; i++) { boxes[3].add(Box.createRigidArea(new Dimension(12, 8))); boxes[3].add(new JButton("boxes[3]: " + i)); } JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); for (int i = 0; i < SIZE; i++) { panel.add(Box.createGlue()); panel.add(new JButton("panel: " + i)); } c.add(boxes[0], BorderLayout.NORTH); c.add(boxes[1], BorderLayout.EAST); c.add(boxes[2], BorderLayout.SOUTH); c.add(boxes[3], BorderLayout.WEST); c.add(panel, BorderLayout.CENTER); setSize(350, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); }
From source file:JDK6TabbedPaneExample.java
public void add() { final JPanel content = new JPanel(); JPanel tab = new JPanel(); tab.setOpaque(false);//from www . j av a2 s .c o m JLabel tabLabel = new JLabel("Tab " + (++tabCounter)); JButton tabCloseButton = new JButton(closeXIcon); tabCloseButton.setPreferredSize(closeButtonSize); tabCloseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int closeTabNumber = tabbedPane.indexOfComponent(content); tabbedPane.removeTabAt(closeTabNumber); } }); tab.add(tabLabel, BorderLayout.WEST); tab.add(tabCloseButton, BorderLayout.EAST); tabbedPane.addTab(null, content); tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, tab); }
From source file:Demo.LineGraph.java
public LineGraph(int sampleNb) { this.sampleNb = sampleNb; InitDataSet();/* w w w . jav a 2 s . c o m*/ InitChart(); // layout setLayout(new BorderLayout()); add(Box.createHorizontalStrut(30), BorderLayout.WEST); add(Box.createHorizontalStrut(30), BorderLayout.EAST); add(Box.createVerticalStrut(30), BorderLayout.NORTH); add(chartPane, BorderLayout.CENTER); }
From source file:Main.java
public Main() { setSize(300, 100);//from w w w . ja v a 2 s .c o m UIManager.put("ProgressBar.selectionBackground", Color.black); UIManager.put("ProgressBar.selectionForeground", Color.white); UIManager.put("ProgressBar.foreground", new Color(8, 32, 128)); progressBar = new JProgressBar(); progressBar.setMinimum(minValue); progressBar.setMaximum(maxValue); progressBar.setStringPainted(true); JButton start = new JButton("Start"); start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread runner = new Thread() { public void run() { counter = minValue; while (counter <= maxValue) { Runnable runme = new Runnable() { public void run() { progressBar.setValue(counter); } }; SwingUtilities.invokeLater(runme); counter++; try { Thread.sleep(100); } catch (Exception ex) { } } } }; runner.start(); } }); getContentPane().add(progressBar, BorderLayout.CENTER); getContentPane().add(start, BorderLayout.WEST); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:JProgressBarDemo.java
public JProgressBarDemo() { super("JProgressBar Demo"); setSize(300, 100);//from w w w. j a v a2s .c o m UIManager.put("ProgressBar.selectionBackground", Color.black); UIManager.put("ProgressBar.selectionForeground", Color.white); UIManager.put("ProgressBar.foreground", new Color(8, 32, 128)); progressBar = new JProgressBar(); progressBar.setMinimum(minValue); progressBar.setMaximum(maxValue); progressBar.setStringPainted(true); JButton start = new JButton("Start"); start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread runner = new Thread() { public void run() { counter = minValue; while (counter <= maxValue) { Runnable runme = new Runnable() { public void run() { progressBar.setValue(counter); } }; SwingUtilities.invokeLater(runme); counter++; try { Thread.sleep(100); } catch (Exception ex) { } } } }; runner.start(); } }); getContentPane().add(progressBar, BorderLayout.CENTER); getContentPane().add(start, BorderLayout.WEST); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }