Example usage for javax.swing JPanel setBorder

List of usage examples for javax.swing JPanel setBorder

Introduction

In this page you can find the example usage for javax.swing JPanel setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:org.pgptool.gui.ui.importkey.KeyImporterView.java

private JPanel buildPanelButtons() {
    JPanel ret = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    ret.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    ret.add(btnImport = new JButton());
    ret.add(btnCancel = new JButton());
    return ret;/*from   w  ww.  j  a v  a2  s  . co m*/
}

From source file:MainClass.java

public MainClass() {
    super();/*from ww  w .  j  a  v  a 2 s.c o m*/

    setChannel(currentNumber);

    numberLabel.setHorizontalAlignment(JLabel.CENTER);
    numberLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(numberLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);
    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Number");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
}

From source file:components.ColorChooserDemo.java

public ColorChooserDemo() {
    super(new BorderLayout());

    //Set up the banner at the top of the window
    banner = new JLabel("Welcome to the Tutorial Zone!", JLabel.CENTER);
    banner.setForeground(Color.yellow);
    banner.setBackground(Color.blue);
    banner.setOpaque(true);/*from w  w  w  . j a  va 2  s  .  c om*/
    banner.setFont(new Font("SansSerif", Font.BOLD, 24));
    banner.setPreferredSize(new Dimension(100, 65));

    JPanel bannerPanel = new JPanel(new BorderLayout());
    bannerPanel.add(banner, BorderLayout.CENTER);
    bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner"));

    //Set up color chooser for setting text color
    tcc = new JColorChooser(banner.getForeground());
    tcc.getSelectionModel().addChangeListener(this);
    tcc.setBorder(BorderFactory.createTitledBorder("Choose Text Color"));

    add(bannerPanel, BorderLayout.CENTER);
    add(tcc, BorderLayout.PAGE_END);
}

From source file:ColorChooserMenu.java

public ColorMenu(String name) {
    super(name);//from www.  j ava2s  .c  o m
    unselectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, getBackground()),
            new BevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
    selectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.red),
            new MatteBorder(1, 1, 1, 1, getBackground()));
    activeBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.blue),
            new MatteBorder(1, 1, 1, 1, getBackground()));

    JPanel p = new JPanel();
    p.setBorder(new EmptyBorder(5, 5, 5, 5));
    p.setLayout(new GridLayout(8, 8));
    paneTable = new Hashtable();

    int[] values = new int[] { 0, 128, 192, 255 };

    for (int r = 0; r < values.length; r++) {
        for (int g = 0; g < values.length; g++) {
            for (int b = 0; b < values.length; b++) {
                Color c = new Color(values[r], values[g], values[b]);
                ColorPane pn = new ColorPane(c);
                p.add(pn);
                paneTable.put(c, pn);
            }
        }
    }
    add(p);
}

From source file:ActionExampleSwing.java

public ActionExampleSwing() {
    super("ActionExample Swing");

    setChannel(currentChannel); // enable/disable the Actions as appropriate

    channelLabel.setHorizontalAlignment(JLabel.CENTER);
    channelLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(channelLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);
    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Channel");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();//  w w  w. j a  va2s.co  m
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
}

From source file:ColorConvertDemo.java

public ColorConvertDemo() {
    super();//w w  w  . j a v  a 2s .co  m
    Container container = getContentPane();

    displayPanel = new ColorPanel();
    container.add(displayPanel);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(1, 2));
    panel.setBorder(new TitledBorder("Click the Gray Scale Button to Create Gray Scale Image..."));

    grayButton = new JButton("Gray Scale");
    grayButton.addActionListener(new ButtonListener());
    resetButton = new JButton("Reset");
    resetButton.addActionListener(new ButtonListener());

    panel.add(grayButton);
    panel.add(resetButton);

    container.add(BorderLayout.SOUTH, panel);

    addWindowListener(new WindowEventHandler());

    setSize(displayPanel.getWidth(), displayPanel.getHeight() + 15);
    setVisible(true);
}

From source file:com.stefanbrenner.droplet.ui.AddDeviceDialog.java

public AddDeviceDialog(final JFrame frame, final IDropletContext dropletContext) {
    super(frame, dropletContext, Messages.getString("AddDeviceDialog.title")); //$NON-NLS-1$

    droplet = dropletContext.getDroplet();

    JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    panel.setLayout(new GridLayout(1, 0, 7, 7));

    btnValve = new JButton(Messages.getString("AddDeviceDialog.valve")); //$NON-NLS-1$
    btnValve.addActionListener(this);
    panel.add(btnValve);// w  ww  . ja v a  2s .  c o m
    btnFlash = new JButton(Messages.getString("AddDeviceDialog.flash")); //$NON-NLS-1$
    btnFlash.addActionListener(this);
    panel.add(btnFlash);
    btnCamera = new JButton(Messages.getString("AddDeviceDialog.camera")); //$NON-NLS-1$
    btnCamera.addActionListener(this);
    panel.add(btnCamera);
    btnButton = new JButton(Messages.getString("AddDeviceDialog.button")); //$NON-NLS-1$
    btnButton.addActionListener(this);
    panel.add(btnButton);
    btnClose = new JButton(Messages.getString("AddDeviceDialog.close")); //$NON-NLS-1$
    btnClose.addActionListener(this);
    panel.add(btnClose);

    add(panel);

    setAlwaysOnTop(true);
    setResizable(false);
    pack();
    setLocationRelativeTo(frame);

    droplet.addPropertyChangeListener(IDroplet.ASSOCIATION_DEVICES, new PropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            updateComponents();
        }
    });
    updateComponents();

}

From source file:ProgressDialog.java

private void setupComponent() {

    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
    gc.gridx = 0;/*from  w ww  . ja  va  2  s.  com*/
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.anchor = GridBagConstraints.NORTHWEST;
    contentPane.add(lblMessage, gc);
    gc.weightx = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    contentPane.add(progressBar, gc);

    setTitle("");
    setModal(true);
    pack();

}

From source file:de.codesourcery.eve.skills.ui.components.impl.TotalItemVolumeComponent.java

@Override
protected JPanel createPanel() {
    textField.setColumns(10);//from  w w w .  ja  v a  2s  .com
    textField.setEditable(false);
    textField.setHorizontalAlignment(JTextField.TRAILING);

    JPanel textFieldPanel = new JPanel();
    textField.setLayout(new GridBagLayout());
    textFieldPanel.setBorder(BorderFactory.createTitledBorder(title));
    textFieldPanel.add(textField,
            constraints(0, 0).weightX(0.5).weightY(0.5).resizeHorizontally().useRelativeWidth().end());

    setVolumeLabel(0.0d);

    return textFieldPanel;
}

From source file:de.codesourcery.eve.skills.ui.components.impl.TotalItemValueComponent.java

@Override
protected JPanel createPanel() {
    textField.setColumns(10);/*from w  w  w.  ja  v a2  s. c om*/
    textField.setEditable(false);
    textField.setHorizontalAlignment(JTextField.TRAILING);

    JPanel textFieldPanel = new JPanel();
    textField.setLayout(new GridBagLayout());
    textFieldPanel.setBorder(BorderFactory.createTitledBorder(title));
    textFieldPanel.add(textField,
            constraints(0, 0).weightX(0.5).weightY(0.5).resizeHorizontally().useRelativeWidth());

    setISKAmountLabel(ISKAmount.ZERO_ISK);
    return textFieldPanel;
}