コード例 #1
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
  /**
   * Sets the <code>defaultButton</code> property, which determines the current default button for
   * this <code>JRootPane</code>. The default button is the button which will be activated when a
   * UI-defined activation event (typically the <b>Enter</b> key) occurs in the root pane regardless
   * of whether or not the button has keyboard focus (unless there is another component within the
   * root pane which consumes the activation event, such as a <code>JTextPane</code>). For default
   * activation to work, the button must be an enabled descendent of the root pane when activation
   * occurs. To remove a default button from this root pane, set this property to <code>null</code>.
   *
   * @see JButton#isDefaultButton
   * @param defaultButton the <code>JButton</code> which is to be the default button
   * @beaninfo description: The button activated by default in this root pane
   */
  public void setDefaultButton(JButton defaultButton) {
    JButton oldDefault = this.defaultButton;

    if (oldDefault != defaultButton) {
      this.defaultButton = defaultButton;

      if (oldDefault != null) {
        oldDefault.repaint();
      }
      if (defaultButton != null) {
        defaultButton.repaint();
      }
    }

    firePropertyChange("defaultButton", oldDefault, defaultButton);
  }
コード例 #2
0
  public void paint(Graphics g) {
    // super.repaint();
    pWidth = this.getWidth() - (inset.left + inset.right);
    pHeight = this.getHeight() - (inset.top + inset.bottom);

    top.setBounds(0, 0, pWidth, (int) (pHeight * (1.0f - graphVerticalSize)));

    nodeGraph.setBounds(0, 0, (int) (top.getWidth() * 0.8f) - 5, top.getHeight());

    nodeGraphView.setBounds(0, 20, nodeGraph.getWidth(), nodeGraph.getHeight() - 20);
    nodeGraphView.getGraphLayout().setSize(nodeGraphView.getSize());

    nodeGraphInform.setBounds(
        (int) (top.getWidth() * 0.8f), 20, (int) (top.getWidth() * 0.2f), top.getHeight() - 20);
    nodeGraphMap.setBounds(0, 0, nodeGraphInform.getWidth(), nodeGraphInform.getWidth());
    nodeGraphMap
        .getGraphLayout()
        .setSize(new Dimension(nodeGraphInform.getWidth(), nodeGraphInform.getWidth()));

    nodeGraphProtocolView.setBounds(
        0,
        nodeGraphMap.getHeight() + 5,
        nodeGraphInform.getWidth(),
        nodeGraphInform.getHeight() - nodeGraphMap.getHeight() - 5);
    /*
    Relaxer relaxer = nodeGraphView.getModel().getRelaxer();
    if(relaxer != null) {
    	relaxer.stop();
    	relaxer.prerelax();
    	relaxer.relax();
    }
    */

    trafficGraph.setBounds(
        0,
        (int) (pHeight * (1.0f - graphVerticalSize)) + 10,
        pWidth,
        (int) (pHeight * graphVerticalSize));
    trafficGraph.repaint();

    graphVerticalSizeBt.setBounds(0, (int) (pHeight * (1.0f - graphVerticalSize)), pWidth, 10);
    graphVerticalSizeBt.repaint();

    graphHorizontalSizeBt.setBounds((int) (top.getWidth() * 0.8f) - 5, 20, 5, top.getHeight());
    graphHorizontalSizeBt.repaint();
  }
 static void repaintTest() {
   try {
     SwingUtilities.invokeAndWait(
         new Runnable() {
           public void run() {
             test = new JButton();
             test.setSize(100, 100);
           }
         });
   } catch (Exception e) {
     e.printStackTrace();
   }
   // repaint(Rectangle) should be ok
   test.repaint(test.getBounds());
   test.repaint(0, 0, 100, 100);
   test.repaint();
 }
コード例 #4
0
 /** Set the text colour. */
 protected void setTextColour(Color colour) {
   if (colour != null) {
     xTextField.setTextColour(colour);
     yTextField.setTextColour(colour);
     colourIcon.setMainColour(colour);
     colourButton.repaint();
     astAxisLabels.setColour(colour);
   }
 }
コード例 #5
0
  /** Update interface to reflect values of the current AstAxisLabel. */
  protected void updateFromAstAxisLabels() {
    //  Nothing in this method should change astAxisLabels, but
    //  we'll switch off the ChangeListener anyway.
    astAxisLabels.removeChangeListener(this);

    xShowLabel.setSelected(astAxisLabels.getXShown());
    if (!inhibitXDocumentListener) {
      xTextField.setText(astAxisLabels.getXLabel());
    }

    yShowLabel.setSelected(astAxisLabels.getYShown());
    if (!inhibitYDocumentListener) {
      yTextField.setText(astAxisLabels.getYLabel());
    }

    xTextField.setTextFont(astAxisLabels.getFont());
    yTextField.setTextFont(astAxisLabels.getFont());
    fontControls.setFont(astAxisLabels.getFont());
    xTextField.setTextColour(astAxisLabels.getColour());
    yTextField.setTextColour(astAxisLabels.getColour());
    colourIcon.setMainColour(astAxisLabels.getColour());
    colourButton.repaint();

    xSpinnerModel.setValue(new Double(astAxisLabels.getXGap()));
    ySpinnerModel.setValue(new Double(astAxisLabels.getYGap()));

    if (astAxisLabels.getXEdge() == AstAxisLabels.BOTTOM) {
      xEdge.setSelectedItem("BOTTOM");
    } else {
      xEdge.setSelectedItem("TOP");
    }
    if (astAxisLabels.getYEdge() == AstAxisLabels.LEFT) {
      yEdge.setSelectedItem("LEFT");
    } else {
      yEdge.setSelectedItem("RIGHT");
    }

    xUnits.setSelected(astAxisLabels.getShowXUnits());
    yUnits.setSelected(astAxisLabels.getShowYUnits());

    astAxisLabels.setXState(true);
    astAxisLabels.setYState(true);

    astAxisLabels.addChangeListener(this);
  }