コード例 #1
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    popupLabel1 = new javax.swing.JLabel();
    popupLabel2 = new javax.swing.JLabel();
    popupField = new javax.swing.JTextField();
    noteLabel = new javax.swing.JLabel();

    setLayout(new java.awt.GridBagLayout());

    popupLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    popupLabel1.setText(
        "<html>Open a popup menu here, which is having its top left corner under the mouse pointer.");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
    add(popupLabel1, gridBagConstraints);

    popupLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    popupLabel2.setText(
        "<html>Open a popup menu here which, is being centered unter the mouse pointer.");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
    add(popupLabel2, gridBagConstraints);

    popupField.setText("Open a popup menu over this entry field.");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
    add(popupField, gridBagConstraints);

    noteLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    noteLabel.setText(
        "<html>There are two ways to use a popup menu: <ul><li>Ctrl+Click to open the popup menu followed by a Click to choose a menu item.</li><li>Ctrl+Mouse Press to open the popup menu followed by a Mouse Release to choose a menu item</li></ul>");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
    add(noteLabel, gridBagConstraints);
  } // </editor-fold>//GEN-END:initComponents
コード例 #2
0
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    fc = new javax.swing.JPanel();
    fromPanel = new javax.swing.JPanel();
    fileNameLabel = new javax.swing.JLabel();
    fileNameTextField = new javax.swing.JTextField();
    strutPanel1 = new javax.swing.JPanel();
    lookInLabel = new javax.swing.JLabel();
    directoryComboBox = new javax.swing.JComboBox();
    strutPanel2 = new javax.swing.JPanel();
    separatorPanel1 = new javax.swing.JPanel();
    separatorPanel2 = new javax.swing.JPanel();
    browserScrollPane = new javax.swing.JScrollPane();
    browser = new ch.randelshofer.quaqua.JBrowser();
    newFolderButton = new javax.swing.JButton();
    separatorPanel = new javax.swing.JPanel();
    formatPanel = new javax.swing.JPanel();
    formatPanel2 = new javax.swing.JPanel();
    filesOfTypeLabel = new javax.swing.JLabel();
    filterComboBox = new javax.swing.JComboBox();
    accessoryPanel = new javax.swing.JPanel();
    buttonPanel = new javax.swing.JPanel();
    cancelButton = new javax.swing.JButton();
    approveButton = new javax.swing.JButton();

    setLayout(new java.awt.BorderLayout());

    fc.setLayout(new java.awt.GridBagLayout());

    fromPanel.setLayout(new java.awt.GridBagLayout());

    fileNameLabel.setText(UIManager.getString("FileChooser.fileNameLabelText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 14, 0);
    fromPanel.add(fileNameLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 14, 0);
    fromPanel.add(fileNameTextField, gridBagConstraints);

    strutPanel1.setLayout(null);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 5;
    fromPanel.add(strutPanel1, gridBagConstraints);

    lookInLabel.setText(UIManager.getString("FileChooser.fromLabelText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0);
    fromPanel.add(lookInLabel, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 0);
    fromPanel.add(directoryComboBox, gridBagConstraints);

    strutPanel2.setLayout(new java.awt.BorderLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 5;
    fromPanel.add(strutPanel2, gridBagConstraints);

    separatorPanel1.setLayout(new java.awt.BorderLayout());

    separatorPanel1.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 1;
    gridBagConstraints.weightx = 1.0E-4;
    fromPanel.add(separatorPanel1, gridBagConstraints);

    separatorPanel2.setLayout(new java.awt.BorderLayout());

    separatorPanel2.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 3;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.ipadx = 40;
    gridBagConstraints.ipady = 1;
    fromPanel.add(separatorPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(fromPanel, gridBagConstraints);

    browserScrollPane.setHorizontalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
    browserScrollPane.setVerticalScrollBarPolicy(
        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    browserScrollPane.setViewportView(browser);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(8, 23, 0, 23);
    fc.add(browserScrollPane, gridBagConstraints);

    newFolderButton.setText(UIManager.getString("FileChooser.newFolderButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
    fc.add(newFolderButton, gridBagConstraints);

    separatorPanel.setLayout(new java.awt.BorderLayout());

    separatorPanel.setBackground(
        javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipady = 1;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(separatorPanel, gridBagConstraints);

    formatPanel.setLayout(new java.awt.GridBagLayout());

    formatPanel2.setLayout(new java.awt.BorderLayout(2, 0));

    filesOfTypeLabel.setText(UIManager.getString("FileChooser.filesOfTypeLabelText"));
    formatPanel2.add(filesOfTypeLabel, java.awt.BorderLayout.WEST);

    formatPanel2.add(filterComboBox, java.awt.BorderLayout.CENTER);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 40);
    formatPanel.add(formatPanel2, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(formatPanel, gridBagConstraints);

    accessoryPanel.setLayout(new java.awt.BorderLayout());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(14, 20, 0, 20);
    fc.add(accessoryPanel, gridBagConstraints);

    buttonPanel.setLayout(new java.awt.GridBagLayout());

    cancelButton.setText(UIManager.getString("FileChooser.cancelButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 18, 16, 0);
    buttonPanel.add(cancelButton, gridBagConstraints);

    approveButton.setText(UIManager.getString("FileChooser.openButtonText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 6, 16, 22);
    buttonPanel.add(approveButton, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridy = 6;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(14, 0, 0, 0);
    fc.add(buttonPanel, gridBagConstraints);

    add(fc, java.awt.BorderLayout.CENTER);
  } // </editor-fold>//GEN-END:initComponents