Package javax.swing

Examples of javax.swing.JPanel


  private void createGui() {
    setTitle(mLocalizer.msg("title", "Channel changes"));

    setLocationRelativeTo(getParent());

    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayout(1, 2, 10, 0));

    JPanel panelAdded = new JPanel(new BorderLayout());
    panelAdded.setBorder(BorderFactory.createTitledBorder(mLocalizer.msg("added", "New channels: {0}", mAddedList.size())));

    DefaultListModel listModel = new DefaultListModel();
    for (int i = 0; i < mAddedList.size(); i++) {
      listModel.addElement(mAddedList.get(i));
    }
    ChannelJList list = new ChannelJList(listModel);
    list.setCellRenderer(new ChannelListCellRenderer(true, true));

    panelAdded.add(new JScrollPane(list), BorderLayout.CENTER);

    JPanel panelDeleted = new JPanel(new BorderLayout());
    panelDeleted.setBorder(BorderFactory.createTitledBorder(mLocalizer.msg("deleted", "Removed channels: {0}", mDeletedList.size())));

    listModel = new DefaultListModel();
    for (int i = 0; i < mDeletedList.size(); i++) {
      listModel.addElement(mDeletedList.get(i));
    }
    list = new ChannelJList(listModel);
    list.setCellRenderer(new ChannelListCellRenderer(true, true));

    panelDeleted.add(new JScrollPane(list), BorderLayout.CENTER);

    JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        setVisible(false);
      }

    });
    btnPanel.add(ok);

    contentPanel.add(panelAdded);
    contentPanel.add(panelDeleted);
    JPanel pane = (JPanel) getContentPane();
    pane.add(contentPanel, BorderLayout.CENTER);
    pane.add(btnPanel, BorderLayout.SOUTH);
    pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    pack();

  }
View Full Code Here


  /**
   * Creates the settings panel for this tab.
   */
  public JPanel createSettingsPanel() {
    FormLayout layout = new FormLayout("5dlu, pref, 3dlu, pref, 3dlu, pref, fill:pref:grow, 3dlu", "");
    mSettingsPn = new JPanel(layout);
    mSettingsPn.setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();
    int currentRow = 1;
   
View Full Code Here

    initComponents();
  }


  protected void initComponents() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel,BoxLayout.Y_AXIS));
    setContentPane(mainPanel);

    OptionPanel dialogPanel = new OptionPanel(2);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS));

    mainPanel.add(dialogPanel);
    mainPanel.add(buttonPanel);

    /**
       Input fields
     **/

    // table
    Vector rules = check.getRules();
    RegExpRuleTableModel tableModel
      = new RegExpRuleTableModel(check.getRules());
    JTable table = new JTable(tableModel);
    JScrollPane scrollPane = new JScrollPane(table);
    dialogPanel.add(scrollPane);


    /**
       End of input fields
     **/

    /**
       Button panel
     **/
    JButton okButton = new JButton();
    okButton.setText("OK");
    okButton.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    updateAndHide();
  }
      });
    buttonPanel.add(okButton);

    JButton closeButton = new JButton();
    closeButton.setText("Cancel");
    closeButton.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {
    exitForm();
  }
      });
    buttonPanel.add(closeButton);

    /**
       End of button panel
    **/

 
View Full Code Here

   * initialize the form.
   */
  private void initComponents() {
    this.setTitle("Allowed URLs");

    JPanel completePanel = new JPanel();
    completePanel.setLayout(new GridBagLayout());


    JPanel leftPanel = new JPanel();
    GridBagConstraints consLeft  = new GridBagConstraints();
    consLeft.gridx = 0;
    consLeft.gridy = 0;
    completePanel.add(leftPanel, consLeft);


    VerticalAlignPanel rightPanel = new VerticalAlignPanel();
    GridBagConstraints consRight  = new GridBagConstraints();
    consRight.gridx = 1;
    consRight.gridy = 0;
    completePanel.add(rightPanel, consRight);


    //
    // buttons
    //
    JButton buttAdd = new JButton();
    buttAdd.setText("Add");
    buttAdd.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        addURL();
      }
    });
    rightPanel.add(buttAdd,1);

    JButton buttDelete = new JButton();
    buttDelete.setText("Delete");
    buttDelete.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        deleteURL();
      }
    });
    rightPanel.add(buttDelete,1);

    JButton buttClose = new JButton();
    buttClose.setText("Close");
    buttClose.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        exitForm();
      }
    });
    rightPanel.add(buttClose,1);

    // list
    urlList = new JList();
    urlList.setVisibleRowCount(6);
    urlList.setMinimumSize(new java.awt.Dimension(40,4));
    urlList.setListData(urls);
    JScrollPane urlScroll = new JScrollPane();
    urlScroll.setViewportView(urlList);
    leftPanel.add(urlScroll);


    getContentPane().add(completePanel);

  }
View Full Code Here

   */
  public JPanel getCustomPanel() {
    final JButton chooseButton = createChooseClassButton();   
    m_ObjectPropertyPanel = new PropertyPanel(this, true);
   
    JPanel customPanel = new JPanel() {
      public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        chooseButton.setEnabled(enabled);
      }
    };
    customPanel.setLayout(new BorderLayout());
    customPanel.add(chooseButton, BorderLayout.WEST);
    customPanel.add(m_ObjectPropertyPanel, BorderLayout.CENTER);
    return customPanel;
  }
View Full Code Here

   
    /**
     * sets up the GUI.
     */
    protected void initGUI() {
      JPanel      panel;
      CheckBoxListModel    model;

      setTitle("Filtering Capabilities...");
      setLayout(new BorderLayout());
     
      panel = new JPanel(new BorderLayout());
      panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      getContentPane().add(panel, BorderLayout.NORTH);
      m_InfoLabel.setText(
      "<html>"
    + m_ClassType.getName().replaceAll(".*\\.", "") + "s"
    + " have to support <i>at least</i> the following capabilities <br>"
    + "(the ones highlighted <font color=\"" + GOETreeNode.NO_SUPPORT + "\">" + GOETreeNode.NO_SUPPORT + "</font> don't meet these requirements <br>"
    + "the ones highlighted  <font color=\"" + GOETreeNode.MAYBE_SUPPORT + "\">" + GOETreeNode.MAYBE_SUPPORT + "</font> possibly meet them):"
    + "</html>");
      panel.add(m_InfoLabel, BorderLayout.CENTER);
     
      // list
      getContentPane().add(new JScrollPane(m_List), BorderLayout.CENTER);
      model = (CheckBoxListModel) m_List.getModel();
      for (Capability cap: Capability.values())
  model.addElement(cap);
     
      // buttons
      panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
      getContentPane().add(panel, BorderLayout.SOUTH);
     
      m_OkButton.setMnemonic('O');
      m_OkButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          updateCapabilities();
          if (m_CapabilitiesFilter == null)
            m_CapabilitiesFilter = new Capabilities(null);
          m_CapabilitiesFilter.assign(m_Capabilities);
          m_Self.setVisible(false);
          showPopup();
        }
      });
      panel.add(m_OkButton);
     
      m_CancelButton.setMnemonic('C');
      m_CancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          m_Self.setVisible(false);
          showPopup();
        }
      });
      panel.add(m_CancelButton);
      pack();
    }
View Full Code Here

    public JTreePopupMenu(JTree tree) {

      m_Self = this;
     
      setLayout(new BorderLayout());
      JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      add(panel, BorderLayout.SOUTH);

      if (ClassDiscovery.hasInterface(CapabilitiesHandler.class, m_ClassType)) {
  // filter
  m_FilterButton.setMnemonic('F');
  m_FilterButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == m_FilterButton) {
        CapabilitiesFilterDialog dialog = new CapabilitiesFilterDialog();
        dialog.setCapabilities(m_CapabilitiesFilter);
        dialog.setPopup(m_Self);
        dialog.setVisible(true);
        m_Support.firePropertyChange("", null, null);
        repaint();
      }
    }
  });
  panel.add(m_FilterButton);
 
  // remove
  m_RemoveFilterButton.setMnemonic('R');
  m_RemoveFilterButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (e.getSource() == m_RemoveFilterButton) {
        m_CapabilitiesFilter = null;
        m_Support.firePropertyChange("", null, null);
        repaint();
      }
    }
  });
  panel.add(m_RemoveFilterButton);
      }

      // close
      m_CloseButton.setMnemonic('C');
      m_CloseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          if (e.getSource() == m_CloseButton) {
            m_Self.setVisible(false);
          }
        }
      });
      panel.add(m_CloseButton);
     
      m_tree = tree;
     
      JPanel treeView = new JPanel();
      treeView.setLayout(new BorderLayout());
      treeView.add(m_tree, BorderLayout.NORTH);
     
      // make backgrounds look the same
      treeView.setBackground(m_tree.getBackground());

      m_scroller = new JScrollPane(treeView);
     
      m_scroller.setPreferredSize(new Dimension(300, 400));
      m_scroller.getVerticalScrollBar().setUnitIncrement(20);
View Full Code Here

     
      setLayout(new BorderLayout());

      if (m_canChangeClassInDialog) {
  JButton chooseButton = createChooseClassButton();
  JPanel top = new JPanel();
  top.setLayout(new BorderLayout());
  top.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  top.add(chooseButton, BorderLayout.WEST);
  top.add(m_ClassNameLabel, BorderLayout.CENTER);
  add(top, BorderLayout.NORTH);
      } else {
  add(m_ClassNameLabel, BorderLayout.NORTH);
      }

      add(m_ChildPropertySheet, BorderLayout.CENTER);
      // Since we resize to the size of the property sheet, a scrollpane isn't
      // typically needed
      // add(new JScrollPane(m_ChildPropertySheet), BorderLayout.CENTER);
     
      JPanel okcButs = new JPanel();
      okcButs.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      okcButs.setLayout(new GridLayout(1, 4, 5, 5));
      okcButs.add(m_OpenBut);
      okcButs.add(m_SaveBut);
      okcButs.add(m_okBut);
      okcButs.add(m_cancelBut);
      add(okcButs, BorderLayout.SOUTH);

      if (m_ClassType != null) {
  m_ObjectNames = getClassesFromProperties();
  if (m_Object != null) {
View Full Code Here

    //  } else {
    //    m_ElementEditor.setValue(m_ElementClass.newInstance());
    //  }
    //}
   
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(view, BorderLayout.CENTER);
    panel.add(m_AddBut, BorderLayout.EAST);
    add(panel, BorderLayout.NORTH);
    add(new JScrollPane(m_ElementList), BorderLayout.CENTER);
          JPanel panel2 = new JPanel();
          panel2.setLayout(new GridLayout(1, 4));
          panel2.add(m_DeleteBut);
          panel2.add(m_EditBut);
          panel2.add(m_UpBut);
          panel2.add(m_DownBut);
          add(panel2, BorderLayout.SOUTH);
    m_ElementEditor
      .addPropertyChangeListener(new PropertyChangeListener() {
      public void propertyChange(PropertyChangeEvent e) {
        repaint();
View Full Code Here

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        initializeComponent();
    }

    private void initializeComponent() {
        JPanel panel = new JPanel();
        panel.setLayout(new GridBagLayout());
        getRootPane().setLayout(new BorderLayout());
        getRootPane().add(panel, BorderLayout.CENTER);

        processIdTextField = new JTextField("com.sample.ruleflow");
        GridBagConstraints c = new GridBagConstraints();
        c.weightx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.insets = new Insets(5, 5, 5, 5);
        panel.add(processIdTextField, c);

        startButton = new JButton("Start");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                start();
            }
        });
        c = new GridBagConstraints();
        c.gridy = 1;
        c.anchor = GridBagConstraints.EAST;
        c.insets = new Insets(5, 5, 5, 5);
        panel.add(startButton, c);
    }
View Full Code Here

TOP

Related Classes of javax.swing.JPanel

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.