Example usage for javax.swing JPanel JPanel

List of usage examples for javax.swing JPanel JPanel

Introduction

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

Prototype

public JPanel() 

Source Link

Document

Creates a new JPanel with a double buffer and a flow layout.

Usage

From source file:JOptionPaneWARNING_MESSAGE.java

public static void main(String[] args) {
    final JPanel panel = new JPanel();

    JOptionPane.showMessageDialog(panel, "A deprecated call", "Warning", JOptionPane.WARNING_MESSAGE);
}

From source file:JOptionPaneERROR_MESSAGE.java

public static void main(String[] args) {
    final JPanel panel = new JPanel();

    JOptionPane.showMessageDialog(panel, "Could not open file", "Error", JOptionPane.ERROR_MESSAGE);

}

From source file:JOptionPaneQUESTION_MESSAGE.java

public static void main(String[] args) {
    final JPanel panel = new JPanel();

    JOptionPane.showMessageDialog(panel, "Are you sure to quit?", "Question", JOptionPane.QUESTION_MESSAGE);
}

From source file:JOptionPaneINFORMATION_MESSAGE.java

public static void main(String[] args) {
    final JPanel panel = new JPanel();

    JOptionPane.showMessageDialog(panel, "Download completed", "Question", JOptionPane.INFORMATION_MESSAGE);
}

From source file:Main.java

public static void main(String[] args) {
    JPanel myPanel = new JPanel();
    JTextField field1 = new JTextField(10);
    JTextField field2 = new JTextField(10);
    myPanel.add(field1);/*from   w w w  .j av  a2  s  .c  o  m*/
    myPanel.add(field2);
    JOptionPane.showMessageDialog(null, myPanel);
    System.out.println(field1.getText() + field2.getText());
}

From source file:PanelWithComponents.java

public static void main(String[] a) {
    JPanel panel = new JPanel();
    JButton okButton = new JButton("OK");
    panel.add(okButton);//from   w  w  w.ja va 2 s  .c  om
    JButton cancelButton = new JButton("Cancel");
    panel.add(cancelButton);
    JFrame frame = new JFrame("Oval Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] a) {
    JPanel panel = new JPanel();

    JDialog dialog = new JDialog((JFrame) SwingUtilities.getWindowAncestor(panel), true);
}

From source file:Main.java

public static void main(String[] argv) {
    JColorChooser chooser = new JColorChooser();
    chooser.setPreviewPanel(new JPanel());

}

From source file:Main.java

public static void main(String[] args) {
    JFrame f = new JFrame();

    JPanel centeredPanel = new JPanel();
    centeredPanel.add(new JButton("one"));
    centeredPanel.add(new JButton("two"));

    f.getContentPane().add(centeredPanel);
    f.pack();/*from  w  w  w .  ja v a2 s. c o m*/
    f.setVisible(true);
}

From source file:ImageTest.java

public static void main(String[] args) {
    JPanel panel = new JPanel();
    ImageLabel label = new ImageLabel(new ImageIcon("images/reactor.png"));
    label.setLocation(29, 37);/*from www  .ja v a  2 s .  com*/
    panel.add(label);

    JFrame frame = new JFrame();
    frame.getContentPane().add(panel);
    frame.pack();
    frame.setVisible(true);
}