protected JPanel createStatusArea() { JPanel statusArea = new JPanel(); JLabel status = new JLabel("No log records to display."); _statusLabel = status; status.setHorizontalAlignment(JLabel.LEFT); statusArea.setBorder(BorderFactory.createEtchedBorder()); statusArea.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); statusArea.add(status); return (statusArea); }
public void newGroup(String name, boolean withBorder) { currentPanel = new JPanel(); if (withBorder) { currentPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(name), BorderFactory.createEmptyBorder(0,0,0,0))); } // using GridBagLayout because it allows for 2 columns with different widths currentLayout = new GridBagLayout(); currentConstraints = new GridBagConstraints(); currentConstraints.anchor = GridBagConstraints.WEST; currentConstraints.fill = GridBagConstraints.HORIZONTAL; currentConstraints.weightx = 1.0; currentConstraints.weighty = 1.0; currentConstraints.insets = new Insets(0, 3, 0, 3); currentConstraints.gridy = -1; currentPanel.setLayout(currentLayout); add(currentPanel); }
JFrame frame = new JFrame(); frame.setLayout(new BorderLayout()); frame.setSize(200, 200); // create the status bar panel and shove it down the bottom of the frame JPanel statusPanel = new JPanel(); statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); frame.add(statusPanel, BorderLayout.SOUTH); statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16)); statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS)); JLabel statusLabel = new JLabel("status"); statusLabel.setHorizontalAlignment(SwingConstants.LEFT); statusPanel.add(statusLabel); frame.setVisible(true);
public static JPanel getFlowLayoutPanelLeftAligned(String title, Component component){ JPanel jp = new JPanel(); jp.setLayout(new FlowLayout(FlowLayout.LEFT)); if(title != null){ if(component instanceof JPanel){ JPanel p = (JPanel)component; p.setBorder(BorderFactory.createTitledBorder(title)); } } jp.add(component); return jp; }
protected JPanel getSamplePanel() { if (samplePanel == null) { Border titledBorder = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), ("Sample")); Border empty = BorderFactory.createEmptyBorder(5, 10, 10, 10); Border border = BorderFactory.createCompoundBorder(titledBorder, empty); samplePanel = new JPanel(); samplePanel.setLayout(new BorderLayout()); samplePanel.setBorder(border); samplePanel.add(getSampleTextField(), BorderLayout.CENTER); } return samplePanel; }
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createTableHeader(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createHeaderPanel(JLabel label) { JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }
private JPanel createTableHeader(JLabel label, String toolTip) { if (toolTip != null) { label.setToolTipText(toolTip); } JPanel headerPanel = new JPanel(new BorderLayout()); headerPanel.add(label, BorderLayout.NORTH); headerPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(TangoColorFactory.ALUMINIUM_5), BorderFactory.createEmptyBorder(2, 2, 2, 2))); return headerPanel; }