List of usage examples for java.awt BorderLayout SOUTH
String SOUTH
To view the source code for java.awt BorderLayout SOUTH.
Click Source Link
From source file:MultipleListeners.java
public MultipleListeners() { JPanel panel = new JPanel(); JButton add = new JButton("+"); add.addActionListener(new ButtonListener1()); add.addActionListener(new ButtonListener2()); panel.add(add);/*www . j av a2s . com*/ panel.add(spinner); JFrame f = new JFrame(); f.add(panel); f.add(statusbar, BorderLayout.SOUTH); f.setSize(300, 200); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:SecretTest.java
public SecretTest() { super("EventListenerList Demo"); setSize(200, 100);/*w ww.j a v a2s . co m*/ setDefaultCloseOperation(EXIT_ON_CLOSE); SecretLabel secret = new SecretLabel("Try Clicking Me"); final JLabel reporter = new JLabel("Event reports will show here..."); secret.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { reporter.setText("Got it: " + ae.getActionCommand()); } }); getContentPane().add(secret, BorderLayout.NORTH); getContentPane().add(reporter, BorderLayout.SOUTH); }
From source file:Main.java
/** * Initialises the {@link JDialog} for the {@link JComponent}. * //from w w w . jav a 2s . c o m * @param dialog * @param component * @param parentComponent */ private static void initDialog(final JDialog dialog, final JComponent component, final Component parentComponent) { dialog.setResizable(true); dialog.setComponentOrientation(component.getComponentOrientation()); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(component, BorderLayout.CENTER); final int buttonWidth = 75; final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 4)); buttonPanel.add(Box.createHorizontalGlue()); @SuppressWarnings("serial") final Action closeAction = new AbstractAction("Close") { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; final JButton button = new JButton(closeAction); fixWidth(button, buttonWidth); buttonPanel.add(button); contentPane.add(buttonPanel, BorderLayout.SOUTH); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations(); if (supportsWindowDecorations) { dialog.setUndecorated(true); component.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); } } dialog.pack(); dialog.setLocationRelativeTo(parentComponent); WindowAdapter adapter = new WindowAdapter() { // private boolean gotFocus = false; public void windowClosing(WindowEvent we) { fireAction(we.getSource(), closeAction, "close"); } }; dialog.addWindowListener(adapter); dialog.addWindowFocusListener(adapter); }
From source file:SplashScreen.java
public SplashScreen(final BufferedImage img) { JPanel panel = new JPanel() { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g.create(); g2d.drawImage(img, 0, 0, img.getWidth(), img.getHeight(), SplashScreen.this); }// w w w . ja v a 2 s . com }; panel.setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); Container content = getContentPane(); content.setLayout(new BorderLayout()); content.add(panel, BorderLayout.NORTH); content.add(label = new JLabel(), BorderLayout.CENTER); content.add(bar = new JProgressBar(), BorderLayout.SOUTH); pack(); setLocationRelativeTo(null); }
From source file:Main.java
public Main() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(buildDemoModel()); JPanel buttonsPanel = new JPanel(); JButton saveButton = new JButton("Capture state"); saveButton.addActionListener(e -> expansionState = saveExpansionState(tree)); JButton loadButton = new JButton("Load state"); loadButton.addActionListener(e -> { loadExpansionState(tree, expansionState); expansionState = saveExpansionState(tree); });/* w w w .j a va2s. co m*/ buttonsPanel.add(saveButton); buttonsPanel.add(loadButton); JPanel content = new JPanel(new BorderLayout()); content.add(buttonsPanel, BorderLayout.SOUTH); content.add(new JScrollPane(tree), BorderLayout.CENTER); frame.add(content); frame.pack(); frame.setVisible(true); }
From source file:RasterDemo.java
public RasterDemo() { super();//from w w w .ja v a2 s . c o m Container container = getContentPane(); displayPanel = new RasterPanel(); container.add(displayPanel); Box box = Box.createHorizontalBox(); flipButton = new JToggleButton("Flip the Image"); flipButton.addActionListener(new ButtonListener()); box.add(Box.createHorizontalGlue()); box.add(flipButton); box.add(Box.createHorizontalGlue()); container.add(box, BorderLayout.SOUTH); addWindowListener(new WindowEventHandler()); setSize(450, 400); show(); }
From source file:CombiningShapes.java
public CombiningShapes() { mShapeOne = new Ellipse2D.Double(40, 20, 80, 80); mShapeTwo = new Rectangle2D.Double(60, 40, 80, 80); setBackground(Color.white);/*from www. j a va 2s. co m*/ setLayout(new BorderLayout()); JPanel controls = new JPanel(); mOptions = new JComboBox(new String[] { "outline", "add", "intersection", "subtract", "exclusive or" }); mOptions.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { repaint(); } }); controls.add(mOptions); add(controls, BorderLayout.SOUTH); }
From source file:Main.java
public Main() { Container content = getContentPane(); content.setBackground(Color.white); JSlider slider1 = new JSlider(); slider1.setBorder(BorderFactory.createTitledBorder("JSlider without Tick Marks")); content.add(slider1, BorderLayout.NORTH); JSlider slider2 = new JSlider(); slider2.setBorder(BorderFactory.createTitledBorder("JSlider with Tick Marks")); slider2.setMajorTickSpacing(20);/*from w ww. ja va 2 s .c o m*/ slider2.setMinorTickSpacing(5); slider2.setPaintTicks(true); content.add(slider2, BorderLayout.CENTER); JSlider slider3 = new JSlider(); slider3.setBorder(BorderFactory.createTitledBorder("JSlider with Tick Marks & Labels")); slider3.setMajorTickSpacing(20); slider3.setMinorTickSpacing(5); slider3.setPaintTicks(true); slider3.setPaintLabels(true); content.add(slider3, BorderLayout.SOUTH); setSize(300, 300); setVisible(true); }
From source file:CubicCurveMouse.java
public CubicCurveMouse() { super();/* www. jav a 2 s.c o m*/ Container container = getContentPane(); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 2)); panel.add(label); panel.add(label); panel.add(coords); container.add(panel, BorderLayout.SOUTH); canvas = new DrawingCanvas(); container.add(canvas); addWindowListener(new WindowEventHandler()); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { editorPane.setDocument(doc);//from w w w . ja va 2 s. c o m editorPane.setEditorKit(styledEditorKit); JScrollPane scrollpane = new JScrollPane(editorPane); scrollpane.setPreferredSize(new Dimension(500, 400)); JPanel comboPanel = new JPanel(); comboPanel.add(fontBox); setLayout(new BorderLayout()); add(scrollpane, BorderLayout.CENTER); add(comboPanel, BorderLayout.SOUTH); Document doc = editorPane.getDocument(); for (int i = 0; i < 20; i++) { int offset = doc.getLength(); String str = "This is line number: " + i + "\n"; try { doc.insertString(offset, str, null); } catch (BadLocationException e) { e.printStackTrace(); } } fontBox.addActionListener(e -> { int size = (Integer) fontBox.getSelectedItem(); Action fontAction = new StyledEditorKit.FontSizeAction(String.valueOf(size), size); fontAction.actionPerformed(e); }); }