private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
Example #2
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 void jbInit() throws Exception {
   mainPanel.setLayout(mainLayout);
   mainLayout.setHgap(2);
   mainLayout.setVgap(2);
   infoPane.setBorder(BorderFactory.createLoweredBevelBorder());
   infoPane.setPreferredSize(new Dimension(500, 400));
   getContentPane().add(mainPanel);
   mainPanel.add(infoPane, BorderLayout.CENTER);
   mainPanel.add(confirmPanel, BorderLayout.SOUTH);
   infoPane.getViewport().add(info, null);
   confirmPanel.addActionListener(this);
 } //	jbInit
Example #3
0
 @Override
 public void removeLayoutComponent(Component comp) {
   if (comp instanceof JRibbon) {
     throw new IllegalArgumentException("Can't remove JRibbon component");
   }
   super.removeLayoutComponent(comp);
 }
  public void removeLayoutComponent(Component comp, boolean force) {
    synchronized (comp.getTreeLock()) {
      if (comp == free) {

        // There is a bug (feature) in the SWING JLayeredPane. When a component's
        // layer is set using setLayer() the component is removed from it's container
        // and then re-added. Unfortunately it is re-added with null constraints. This
        // would cause the free component to become a CENTER component. To get round
        // this DO NOT remove a free component from the layout.

        if (force) {
          System.out.println("Removed free component " + comp);
          free = null;
        } else {
          // on dragging and dropping a result into annotView this message comes
          // with the JScrollBar which seems bizarre to me and bears looking into.
          // For now im just commenting out the message.
          // their should be a if (Debug.DEBUG) or something
          // System.out.println("Attempt to removed free component " + comp);
        }
      } else {
        // System.out.println("Removed super component " + comp);
        super.removeLayoutComponent(comp);
      }
    }
  }
  public void layoutContainer(Container target) {
    //      System.out.println("Laying out container " + target);
    super.layoutContainer(target);
    if (free != null) { // what is free??
      Point loc = free.getLocation();
      Dimension sz = free.getSize();

      // System.out.println("Laying out free component " + free);
      free.setBounds(loc.x, loc.y, sz.width, sz.height);
    }
  }
Example #6
0
 @Override
 public void addLayoutComponent(Component comp, Object constraints) {
   if ((constraints != null) && constraints.equals(BorderLayout.NORTH)) {
     if (getLayoutComponent(BorderLayout.NORTH) != null) {
       throw new IllegalArgumentException("Already has a NORTH JRibbon component");
     }
     if (!(comp instanceof JRibbon)) {
       throw new IllegalArgumentException("Can't add non-JRibbon component to NORTH location");
     }
   }
   super.addLayoutComponent(comp, constraints);
 }
 public void addLayoutComponent(Component component, Object constraints) {
   synchronized (component.getTreeLock()) {
     if (constraints != null && ((String) constraints).equals(NONE)) {
       free = component;
       // System.out.println("Added free component " + component);
     } else {
       if (component != free) {
         // System.out.println("Added super component " + component);
         super.addLayoutComponent(component, constraints);
       } else {
         System.out.println("Tried to readd free component " + component);
       }
     }
   }
   // System.out.println("returned from addLayoutComponent");
 }
  private void jbInit() throws Exception {
    titledBorder1 = new TitledBorder("");
    this.setLayout(baseLayout);

    double[][] lower_size = {
      {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL}
    };
    mLowerPanelLayout = new TableLayout(lower_size);

    mLowerPanel.setLayout(mLowerPanelLayout);

    double[][] dir_size = {
      {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL}
    };
    mDirectionsPanelLayout = new TableLayout(dir_size);
    mDirectionsPanel.setLayout(mDirectionsPanelLayout);

    // Try to get icons for the toolbar buttons
    try {
      ClassLoader loader = getClass().getClassLoader();
      mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif"));
      mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif"));
      mDisabledRemoveIcon =
          new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif"));

      mAddNodeBtn.setIcon(mAddIcon);
      mRemoveNodeBtn.setIcon(mRemoveIcon);
      mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon);
    } catch (Exception e) {
      // Ack! No icons. Use text labels instead
      mAddNodeBtn.setText("Add");
      mRemoveNodeBtn.setText("Remove");
    }

    /*
    mAddNodeBtn.setMaximumSize(new Dimension(130, 33));
    mAddNodeBtn.setMinimumSize(new Dimension(130, 33));
    mAddNodeBtn.setPreferredSize(new Dimension(130, 33));
    mAddNodeBtn.setText("Add Node");
    */
    mAddNodeBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mAddNodeBtn_actionPerformed(e);
          }
        });
    /*
    mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33));
    mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33));
    mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33));
    mRemoveNodeBtn.setText("Remove Node");
    */
    mRemoveNodeBtn.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mRemoveNode();
          }
        });
    mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING);
    mHostnameLabel.setLabelFor(mHostnameField);
    mHostnameLabel.setText("Hostname:");

    mHostnameField.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mAddNodeBtn_actionPerformed(e);
          }
        });
    mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder());
    mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20));
    mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    mTitleLabel.setText("Add Cluster Nodes");
    mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration.");
    mDirectionsLabel.setLineWrap(true);
    mDirectionsLabel.setEditable(false);
    mDirectionsLabel.setBackground(mTitleLabel.getBackground());

    baseLayout.setHgap(5);
    baseLayout.setVgap(5);
    mLowerPanel.add(
        mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mListScrollPane1,
        new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL));
    mLowerPanel.add(
        mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL));
    this.add(mLowerPanel, BorderLayout.CENTER);
    mListScrollPane1.getViewport().add(lstNodes, null);
    mDirectionsPanel.add(
        mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL));
    mDirectionsPanel.add(
        mDirectionsLabel,
        new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL));
    mDirectionsPanel.add(
        mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL));
    this.add(mDirectionsPanel, BorderLayout.NORTH);
  }
 public void invalidateLayout(Container target) {
   // System.out.println("Called invalidateLayout");
   super.invalidateLayout(target);
 }