Example usage for java.awt Panel Panel

List of usage examples for java.awt Panel Panel

Introduction

In this page you can find the example usage for java.awt Panel Panel.

Prototype

public Panel() 

Source Link

Document

Creates a new panel using the default layout manager.

Usage

From source file:SaveYourDrawingToFile.java

public SaveYourDrawingToFile() {
    addMouseListener(this);

    setLayout(new BorderLayout());
    Panel pan = new Panel();
    clearBtn.addActionListener(this);
    pan.add(clearBtn);/*from ww  w.  j a  v a 2s.co m*/
    saveBtn.addActionListener(this);
    pan.add(saveBtn);
    restoreBtn.addActionListener(this);
    pan.add(restoreBtn);
    quitBtn.addActionListener(this);
    pan.add(quitBtn);
    add("North", pan);
    setSize(350, 200);
}

From source file:com.seniorproject.augmentedreality.chart.ChartCreator.java

public Panel drawChart() {
    dataset = createDataset();/*from   ww  w.  j  a  v  a  2 s  . com*/
    chart = createChart(dataset);
    chartPanel = new ChartPanel(chart);
    //        chartPanel.setPreferredSize(new java.awt.Dimension(640, 480));
    Panel panel = new Panel();
    panel.setSize(640, 480);
    panel.add(chartPanel);
    panel.setVisible(true);
    return panel;
}

From source file:SysTray.java

private Image getImage() throws HeadlessException {
    Icon defaultIcon = MetalIconFactory.getTreeHardDriveIcon();
    Image img = new BufferedImage(defaultIcon.getIconWidth(), defaultIcon.getIconHeight(),
            BufferedImage.TYPE_4BYTE_ABGR);
    defaultIcon.paintIcon(new Panel(), img.getGraphics(), 0, 0);
    return img;//ww  w .jav  a  2  s  .co  m
}

From source file:WebCrawler.java

public void init() {

    // set up the main UI panel
    panelMain = new Panel();
    panelMain.setLayout(new BorderLayout(5, 5));

    // text entry components
    Panel panelEntry = new Panel();
    panelEntry.setLayout(new BorderLayout(5, 5));

    Panel panelURL = new Panel();
    panelURL.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelURL = new Label("Starting URL: ", Label.RIGHT);
    panelURL.add(labelURL);/*from   w ww . j  a v a  2  s  . c  om*/
    textURL = new TextField("", 40);
    panelURL.add(textURL);
    panelEntry.add("North", panelURL);

    Panel panelType = new Panel();
    panelType.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    Label labelType = new Label("Content type: ", Label.RIGHT);
    panelType.add(labelType);
    choiceType = new Choice();
    choiceType.addItem("text/html");
    choiceType.addItem("audio/basic");
    choiceType.addItem("audio/au");
    choiceType.addItem("audio/aiff");
    choiceType.addItem("audio/wav");
    choiceType.addItem("video/mpeg");
    choiceType.addItem("video/x-avi");
    panelType.add(choiceType);
    panelEntry.add("South", panelType);

    panelMain.add("North", panelEntry);

    // list of result URLs
    Panel panelListButtons = new Panel();
    panelListButtons.setLayout(new BorderLayout(5, 5));

    Panel panelList = new Panel();
    panelList.setLayout(new BorderLayout(5, 5));
    Label labelResults = new Label("Search results");
    panelList.add("North", labelResults);
    Panel panelListCurrent = new Panel();
    panelListCurrent.setLayout(new BorderLayout(5, 5));
    listMatches = new List(10);
    panelListCurrent.add("North", listMatches);
    labelStatus = new Label("");
    panelListCurrent.add("South", labelStatus);
    panelList.add("South", panelListCurrent);

    panelListButtons.add("North", panelList);

    // control buttons
    Panel panelButtons = new Panel();
    Button buttonSearch = new Button(SEARCH);
    buttonSearch.addActionListener(this);
    panelButtons.add(buttonSearch);
    Button buttonStop = new Button(STOP);
    buttonStop.addActionListener(this);
    panelButtons.add(buttonStop);

    panelListButtons.add("South", panelButtons);

    panelMain.add("South", panelListButtons);

    add(panelMain);
    setVisible(true);

    repaint();

    // initialize search data structures
    vectorToSearch = new Vector();
    vectorSearched = new Vector();
    vectorMatches = new Vector();

    // set default for URL access
    URLConnection.setDefaultAllowUserInteraction(false);
}

From source file:Presentation.MainWindow.java

/** Construction de la fentre d'affichage principale */
public MainWindow() {
    super();//from  w  w w. ja v a  2s .c  om
    setTitle("Interface d'administration du frigo");
    setSize(800, 1000);

    Panel mainPanel = new Panel();
    BoxLayout layout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
    add(mainPanel);
    this.mPanel = mainPanel;
    addSlider();
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent we) {
            dispose();
        }
    });

    show();

}

From source file:GUIManagerQuery.java

/***************************************************************************
 * Construct the GUIManagerQuery object, constructing the various components
 * and laying them out on the screen./* www .  j  a  va2  s  .  com*/
 **************************************************************************/
public GUIManagerQuery() {
    super("GUIManagerQuery");
    setLayout(new BorderLayout());

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    versionLabel = new Label("JMF v" + Manager.getVersion());
    add(versionLabel, "North");

    Panel lower = new Panel();
    lower.add(new Label("Content/Protocol"));
    contentsField = new TextField(32);
    lower.add(contentsField);
    add(lower, "South");

    results = new TextArea(20, 80);
    results.setEditable(false);
    add(results, "Center");

    Panel controls = new Panel();
    controls.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    hintsButton = new Button("Hints");
    gbc.gridx = 0;
    gbc.gridy = 0;
    controls.add(hintsButton, gbc);
    hintsButton.addActionListener(this);

    playersButton = new Button("Players");
    gbc.gridy = 1;
    controls.add(playersButton, gbc);
    playersButton.addActionListener(this);

    processorsButton = new Button("Processors");
    gbc.gridy = 2;
    controls.add(processorsButton, gbc);
    processorsButton.addActionListener(this);

    sourcesButton = new Button("DataSources");
    gbc.gridy = 3;
    controls.add(sourcesButton, gbc);
    sourcesButton.addActionListener(this);

    add(controls, "East");
}

From source file:TimerTest.java

public void init() {
    Panel panel = new Panel();
    String header = new String("              J3D Timer                System Timer\n");
    TextArea textArea = new TextArea(header, 12, 35, TextArea.SCROLLBARS_NONE);
    panel.add(textArea);//w  w  w .  j a  v  a2s. c  o m
    this.add(panel);

    for (int i = 0; i < ticks.length; i++) {
        ticks[i] = J3DTimer.getValue();
        sysTime[i] = System.currentTimeMillis();
    }

    for (int i = 0; i < ticks.length; i++)
        //System.out.println("tick "+ticks[i]+" "+sysTime[i] );
        textArea.append("tick " + ticks[i] + "    " + sysTime[i] + "\n");
    //System.out.println("Resolution "+J3DTimer.getResolution() );
    textArea.append("Resolution " + J3DTimer.getResolution() + "\n");

}

From source file:GUIMediaStatistics.java

/**********************************************************************
* Construct the GUIMediaStatistics object, constructing the various
* components and laying them out on the screen.
**********************************************************************/
public GUIMediaStatistics() {
    super("GUIMediaStatistics");
    setLayout(new BorderLayout());

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from www.jav a 2 s.  com
        }
    });

    Panel filePanel = new Panel();

    filePanel.add(new Label("File:"));
    mediaField = new TextField(40);
    filePanel.add(mediaField);

    browseButton = new Button("browse...");
    filePanel.add(browseButton);
    browseButton.addActionListener(this);

    getStatsButton = new Button("get stats...");
    filePanel.add(getStatsButton);
    getStatsButton.addActionListener(this);

    add(filePanel, "North");

    results = new TextArea(80, 10);
    results.setEditable(false);
    add(results, "Center");
}

From source file:br.upe.ecomp.dosa.controller.chart.FileLineChartManager.java

private Panel createContents(double[] values, boolean logarithmicYAxis, String measurement, int step,
        File file) {/*from  w ww  . j  av a  2  s. c  om*/
    Panel chartPanel = new Panel();

    chartPanel.setLayout(new java.awt.GridLayout(1, 1));

    JFreeChart chart = createChart("", "Sample", "Fitness", createSampleDataset(values, measurement, step),
            false);

    ImageSaver.saveImage(chart.createBufferedImage(1000, 800), file.getParent(), "graph.png");

    ChartPanel jFreeChartPanel = new ChartPanel(chart);
    chartPanel.add(jFreeChartPanel);

    return chartPanel;
}

From source file:Presentation.MainWindow.java

/** Ajout  la fentre de la liste de ports COM dtectes par l'ordinateur pour rcuprer les donnes */
public void addCOMPorts(ArrayList<String> Ports) {
    Panel panel = new Panel();
    Label label = new Label("Ports COM");

    Choice COMPorts = new Choice();

    for (String port : Ports) {
        COMPorts.add(port);/*w w w.  j a v a2 s. co  m*/
    }

    panel.add(label);
    panel.add(COMPorts);

    mPanel.add(panel);

    show();
}