コード例 #1
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /**
  * Called by the constructor methods to create the default <code>glassPane</code>. By default this
  * method creates a new <code>JComponent</code> with visibility set to false.
  *
  * @return the default <code>glassPane</code>
  */
 protected Component createGlassPane() {
   JComponent c = new JPanel();
   c.setName(this.getName() + ".glassPane");
   c.setVisible(false);
   ((JPanel) c).setOpaque(false);
   return c;
 }
コード例 #2
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
 private void updateLabelSizes() {
   Dictionary labelTable = getLabelTable();
   if (labelTable != null) {
     Enumeration labels = labelTable.elements();
     while (labels.hasMoreElements()) {
       JComponent component = (JComponent) labels.nextElement();
       component.setSize(component.getPreferredSize());
     }
   }
 }
コード例 #3
0
 /**
  * See readObject() and writeObject() in JComponent for more information about serialization in
  * Swing.
  */
 private void writeObject(ObjectOutputStream s) throws IOException {
   s.defaultWriteObject();
   if (getUIClassID().equals(uiClassID)) {
     byte count = JComponent.getWriteObjCounter(this);
     JComponent.setWriteObjCounter(this, --count);
     if (count == 0 && ui != null) {
       ui.installUI(this);
     }
   }
 }
コード例 #4
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
  /**
   * Updates the UIs for the labels in the label table by calling {@code updateUI} on each label.
   * The UIs are updated from the current look and feel. The labels are also set to their preferred
   * size.
   *
   * @see #setLabelTable
   * @see JComponent#updateUI
   */
  protected void updateLabelUIs() {
    Dictionary labelTable = getLabelTable();

    if (labelTable == null) {
      return;
    }
    Enumeration labels = labelTable.keys();
    while (labels.hasMoreElements()) {
      JComponent component = (JComponent) labelTable.get(labels.nextElement());
      component.updateUI();
      component.setSize(component.getPreferredSize());
    }
  }
コード例 #5
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Processes key stroke events such as mnemonics and accelerators.
  *
  * @param evt the key event to be processed
  */
 protected void processKeyEvent(KeyEvent evt) {
   MenuSelectionManager.defaultManager().processKeyEvent(evt);
   if (evt.isConsumed()) {
     return;
   }
   super.processKeyEvent(evt);
 }
コード例 #6
0
ファイル: JApplet.java プロジェクト: subxiang/jdk-source-code
  /**
   * Creates a swing applet instance.
   *
   * <p>This constructor sets the component's locale property to the value returned by <code>
   * JComponent.getDefaultLocale</code>.
   *
   * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true.
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @see JComponent#getDefaultLocale
   */
  public JApplet() throws HeadlessException {
    super();
    // Check the timerQ and restart if necessary.
    TimerQueue q = TimerQueue.sharedInstance();
    if (q != null) {
      synchronized (q) {
        if (!q.running) q.start();
      }
    }

    /* Workaround for bug 4155072.  The shared double buffer image
     * may hang on to a reference to this applet; unfortunately
     * Image.getGraphics() will continue to call JApplet.getForeground()
     * and getBackground() even after this applet has been destroyed.
     * So we ensure that these properties are non-null here.
     */
    setForeground(Color.black);
    setBackground(Color.white);

    setLocale(JComponent.getDefaultLocale());
    setLayout(new BorderLayout());
    setRootPane(createRootPane());
    setRootPaneCheckingEnabled(true);

    // This code should be changed after the RFE 4719336 is resolved
    // to not make the applet a FocusCycleRoot, but set it's
    // FocusTraversalPolicy only.
    setFocusCycleRoot(true);
    setFocusTraversalPolicy(
        KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy());

    enableEvents(AWTEvent.KEY_EVENT_MASK);
  }
コード例 #7
0
 /**
  * Enables the component so that the knob position can be changed. When the disabled, the knob
  * position cannot be changed.
  *
  * @param x a boolean value, where true enables the component and false disables it
  */
 public void setEnabled(boolean x) {
   super.setEnabled(x);
   Component[] children = getComponents();
   for (int i = 0; i < children.length; i++) {
     children[i].setEnabled(x);
   }
 }
コード例 #8
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
 /**
  * Enables the component so that the knob position can be changed. When the disabled, the knob
  * position cannot be changed.
  *
  * @param x a boolean value, where true enables the component and false disables it
  */
 public void setEnabled(boolean x) {
   super.setEnabled(x);
   Component[] children = getComponents();
   for (Component child : children) {
     child.setEnabled(x);
   }
 }
コード例 #9
0
ファイル: JApplet.java プロジェクト: Cultivators/JDKResource
  /**
   * Creates a swing applet instance.
   *
   * <p>This constructor sets the component's locale property to the value returned by <code>
   * JComponent.getDefaultLocale</code>.
   *
   * @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true.
   * @see java.awt.GraphicsEnvironment#isHeadless
   * @see JComponent#getDefaultLocale
   */
  public JApplet() throws HeadlessException {
    super();
    // Check the timerQ and restart if necessary.
    TimerQueue q = TimerQueue.sharedInstance();
    if (q != null) {
      q.startIfNeeded();
    }

    /* Workaround for bug 4155072.  The shared double buffer image
     * may hang on to a reference to this applet; unfortunately
     * Image.getGraphics() will continue to call JApplet.getForeground()
     * and getBackground() even after this applet has been destroyed.
     * So we ensure that these properties are non-null here.
     */
    setForeground(Color.black);
    setBackground(Color.white);

    setLocale(JComponent.getDefaultLocale());
    setLayout(new BorderLayout());
    setRootPane(createRootPane());
    setRootPaneCheckingEnabled(true);

    setFocusTraversalPolicyProvider(true);
    sun.awt.SunToolkit.checkAndSetPolicy(this);

    enableEvents(AWTEvent.KEY_EVENT_MASK);
  }
コード例 #10
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
  /**
   * Overridden to enforce the position of the glass component as the zero child.
   *
   * @param comp the component to be enhanced
   * @param constraints the constraints to be respected
   * @param index the index
   */
  protected void addImpl(Component comp, Object constraints, int index) {
    super.addImpl(comp, constraints, index);

    /// We are making sure the glassPane is on top.
    if (glassPane != null && glassPane.getParent() == this && getComponent(0) != glassPane) {
      add(glassPane, 0);
    }
  }
コード例 #11
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Removes the component at the specified index from this popup menu.
  *
  * @param pos the position of the item to be removed
  * @exception IllegalArgumentException if the value of <code>pos</code> < 0, or if the value of
  *     <code>pos</code> is greater than the number of items
  */
 public void remove(int pos) {
   if (pos < 0) {
     throw new IllegalArgumentException("index less than zero.");
   }
   if (pos > getComponentCount() - 1) {
     throw new IllegalArgumentException("index greater than the number of items.");
   }
   super.remove(pos);
 }
コード例 #12
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /**
  * Called by the constructor methods to create the default <code>contentPane</code>. By default
  * this method creates a new <code>JComponent</code> add sets a <code>BorderLayout</code> as its
  * <code>LayoutManager</code>.
  *
  * @return the default <code>contentPane</code>
  */
 protected Container createContentPane() {
   JComponent c = new JPanel();
   c.setName(this.getName() + ".contentPane");
   c.setLayout(
       new BorderLayout() {
         /* This BorderLayout subclass maps a null constraint to CENTER.
          * Although the reference BorderLayout also does this, some VMs
          * throw an IllegalArgumentException.
          */
         public void addLayoutComponent(Component comp, Object constraints) {
           if (constraints == null) {
             constraints = BorderLayout.CENTER;
           }
           super.addLayoutComponent(comp, constraints);
         }
       });
   return c;
 }
コード例 #13
0
  public void paint(Graphics g) {
    super.paint(g);
    if (thumbnail != null) {
      int x = getWidth() / 2 - thumbnail.getIconWidth() / 2;
      int y = getHeight() / 2 - thumbnail.getIconHeight() / 2;
      if (y < 0) {
        y = 0;
      }

      if (x < 5) {
        x = 5;
      }
      thumbnail.paintIcon(this, g, x, y);
    }
  }
コード例 #14
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
  ////////////
  // Serialization support.
  ////////////
  private void writeObject(ObjectOutputStream s) throws IOException {
    Vector<Object> values = new Vector<Object>();

    s.defaultWriteObject();
    // Save the invoker, if its Serializable.
    if (invoker != null && invoker instanceof Serializable) {
      values.addElement("invoker");
      values.addElement(invoker);
    }
    // Save the popup, if its Serializable.
    if (popup != null && popup instanceof Serializable) {
      values.addElement("popup");
      values.addElement(popup);
    }
    s.writeObject(values);

    if (getUIClassID().equals(uiClassID)) {
      byte count = JComponent.getWriteObjCounter(this);
      JComponent.setWriteObjCounter(this, --count);
      if (count == 0 && ui != null) {
        ui.installUI(this);
      }
    }
  }
コード例 #15
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
 /**
  * Sets the L&F object that renders this component.
  *
  * @param ui the <code>ScrollBarUI</code> L&F object
  * @see UIDefaults#getUI
  * @since 1.4
  * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that
  *     implements the Component's LookAndFeel
  */
 public void setUI(ScrollBarUI ui) {
   super.setUI(ui);
 }
コード例 #16
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /** {@inheritDoc} */
 public void removeNotify() {
   super.removeNotify();
 }
コード例 #17
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /** {@inheritDoc} */
 public void addNotify() {
   super.addNotify();
   enableEvents(AWTEvent.KEY_EVENT_MASK);
 }
コード例 #18
0
ファイル: Plotter.java プロジェクト: susotajuraj/jdk8u-jdk
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    int width = getWidth() - rightMargin - leftMargin - 10;
    int height = getHeight() - topMargin - bottomMargin;
    if (width <= 0 || height <= 0) {
      // not enough room to paint anything
      return;
    }

    Color oldColor = g.getColor();
    Font oldFont = g.getFont();
    Color fg = getForeground();
    Color bg = getBackground();
    boolean bgIsLight = (bg.getRed() > 200 && bg.getGreen() > 200 && bg.getBlue() > 200);

    ((Graphics2D) g)
        .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    if (smallFont == null) {
      smallFont = oldFont.deriveFont(9.0F);
    }

    r.x = leftMargin - 5;
    r.y = topMargin - 8;
    r.width = getWidth() - leftMargin - rightMargin;
    r.height = getHeight() - topMargin - bottomMargin + 16;

    if (border == null) {
      // By setting colors here, we avoid recalculating them
      // over and over.
      border =
          new BevelBorder(
              BevelBorder.LOWERED,
              getBackground().brighter().brighter(),
              getBackground().brighter(),
              getBackground().darker().darker(),
              getBackground().darker());
    }

    border.paintBorder(this, g, r.x, r.y, r.width, r.height);

    // Fill background color
    g.setColor(bgColor);
    g.fillRect(r.x + 2, r.y + 2, r.width - 4, r.height - 4);
    g.setColor(oldColor);

    long tMin = Long.MAX_VALUE;
    long tMax = Long.MIN_VALUE;
    long vMin = Long.MAX_VALUE;
    long vMax = 1;

    int w = getWidth() - rightMargin - leftMargin - 10;
    int h = getHeight() - topMargin - bottomMargin;

    if (times.size > 1) {
      tMin = Math.min(tMin, times.time(0));
      tMax = Math.max(tMax, times.time(times.size - 1));
    }
    long viewRangeMS;
    if (viewRange > 0) {
      viewRangeMS = viewRange * MINUTE;
    } else {
      // Display full time range, but no less than a minute
      viewRangeMS = Math.max(tMax - tMin, 1 * MINUTE);
    }

    // Calculate min/max values
    for (Sequence seq : seqs) {
      if (seq.size > 0) {
        for (int i = 0; i < seq.size; i++) {
          if (seq.size == 1 || times.time(i) >= tMax - viewRangeMS) {
            long val = seq.value(i);
            if (val > Long.MIN_VALUE) {
              vMax = Math.max(vMax, val);
              vMin = Math.min(vMin, val);
            }
          }
        }
      } else {
        vMin = 0L;
      }
      if (unit == Unit.BYTES || !seq.isPlotted) {
        // We'll scale only to the first (main) value set.
        // TODO: Use a separate property for this.
        break;
      }
    }

    // Normalize scale
    vMax = normalizeMax(vMax);
    if (vMin > 0) {
      if (vMax / vMin > 4) {
        vMin = 0;
      } else {
        vMin = normalizeMin(vMin);
      }
    }

    g.setColor(fg);

    // Axes
    // Draw vertical axis
    int x = leftMargin - 18;
    int y = topMargin;
    FontMetrics fm = g.getFontMetrics();

    g.drawLine(x, y, x, y + h);

    int n = 5;
    if (("" + vMax).startsWith("2")) {
      n = 4;
    } else if (("" + vMax).startsWith("3")) {
      n = 6;
    } else if (("" + vMax).startsWith("4")) {
      n = 4;
    } else if (("" + vMax).startsWith("6")) {
      n = 6;
    } else if (("" + vMax).startsWith("7")) {
      n = 7;
    } else if (("" + vMax).startsWith("8")) {
      n = 8;
    } else if (("" + vMax).startsWith("9")) {
      n = 3;
    }

    // Ticks
    ArrayList<Long> tickValues = new ArrayList<Long>();
    tickValues.add(vMin);
    for (int i = 0; i < n; i++) {
      long v = i * vMax / n;
      if (v > vMin) {
        tickValues.add(v);
      }
    }
    tickValues.add(vMax);
    n = tickValues.size();

    String[] tickStrings = new String[n];
    for (int i = 0; i < n; i++) {
      long v = tickValues.get(i);
      tickStrings[i] = getSizeString(v, vMax);
    }

    // Trim trailing decimal zeroes.
    if (decimals > 0) {
      boolean trimLast = true;
      boolean removedDecimalPoint = false;
      do {
        for (String str : tickStrings) {
          if (!(str.endsWith("0") || str.endsWith("."))) {
            trimLast = false;
            break;
          }
        }
        if (trimLast) {
          if (tickStrings[0].endsWith(".")) {
            removedDecimalPoint = true;
          }
          for (int i = 0; i < n; i++) {
            String str = tickStrings[i];
            tickStrings[i] = str.substring(0, str.length() - 1);
          }
        }
      } while (trimLast && !removedDecimalPoint);
    }

    // Draw ticks
    int lastY = Integer.MAX_VALUE;
    for (int i = 0; i < n; i++) {
      long v = tickValues.get(i);
      y = topMargin + h - (int) (h * (v - vMin) / (vMax - vMin));
      g.drawLine(x - 2, y, x + 2, y);
      String s = tickStrings[i];
      if (unit == Unit.PERCENT) {
        s += "%";
      }
      int sx = x - 6 - fm.stringWidth(s);
      if (y < lastY - 13) {
        if (checkLeftMargin(sx)) {
          // Wait for next repaint
          return;
        }
        g.drawString(s, sx, y + 4);
      }
      // Draw horizontal grid line
      g.setColor(Color.lightGray);
      g.drawLine(r.x + 4, y, r.x + r.width - 4, y);
      g.setColor(fg);
      lastY = y;
    }

    // Draw horizontal axis
    x = leftMargin;
    y = topMargin + h + 15;
    g.drawLine(x, y, x + w, y);

    long t1 = tMax;
    if (t1 <= 0L) {
      // No data yet, so draw current time
      t1 = System.currentTimeMillis();
    }
    long tz = timeDF.getTimeZone().getOffset(t1);
    long tickInterval = calculateTickInterval(w, 40, viewRangeMS);
    if (tickInterval > 3 * HOUR) {
      tickInterval = calculateTickInterval(w, 80, viewRangeMS);
    }
    long t0 = tickInterval - (t1 - viewRangeMS + tz) % tickInterval;
    while (t0 < viewRangeMS) {
      x = leftMargin + (int) (w * t0 / viewRangeMS);
      g.drawLine(x, y - 2, x, y + 2);

      long t = t1 - viewRangeMS + t0;
      String str = formatClockTime(t);
      g.drawString(str, x, y + 16);
      // if (tickInterval > (1 * HOUR) && t % (1 * DAY) == 0) {
      if ((t + tz) % (1 * DAY) == 0) {
        str = formatDate(t);
        g.drawString(str, x, y + 27);
      }
      // Draw vertical grid line
      g.setColor(Color.lightGray);
      g.drawLine(x, topMargin, x, topMargin + h);
      g.setColor(fg);
      t0 += tickInterval;
    }

    // Plot values
    int start = 0;
    int nValues = 0;
    int nLists = seqs.size();
    if (nLists > 0) {
      nValues = seqs.get(0).size;
    }
    if (nValues == 0) {
      g.setColor(oldColor);
      return;
    } else {
      Sequence seq = seqs.get(0);
      // Find starting point
      for (int p = 0; p < seq.size; p++) {
        if (times.time(p) >= tMax - viewRangeMS) {
          start = p;
          break;
        }
      }
    }

    // Optimization: collapse plot of more than four values per pixel
    int pointsPerPixel = (nValues - start) / w;
    if (pointsPerPixel < 4) {
      pointsPerPixel = 1;
    }

    // Draw graphs
    // Loop backwards over sequences because the first needs to be painted on top
    for (int i = nLists - 1; i >= 0; i--) {
      int x0 = leftMargin;
      int y0 = topMargin + h + 1;

      Sequence seq = seqs.get(i);
      if (seq.isPlotted && seq.size > 0) {
        // Paint twice, with white and with color
        for (int pass = 0; pass < 2; pass++) {
          g.setColor((pass == 0) ? Color.white : seq.color);
          int x1 = -1;
          long v1 = -1;
          for (int p = start; p < nValues; p += pointsPerPixel) {
            // Make sure we get the last value
            if (pointsPerPixel > 1 && p >= nValues - pointsPerPixel) {
              p = nValues - 1;
            }
            int x2 = (int) (w * (times.time(p) - (t1 - viewRangeMS)) / viewRangeMS);
            long v2 = seq.value(p);
            if (v2 >= vMin && v2 <= vMax) {
              int y2 = (int) (h * (v2 - vMin) / (vMax - vMin));
              if (x1 >= 0 && v1 >= vMin && v1 <= vMax) {
                int y1 = (int) (h * (v1 - vMin) / (vMax - vMin));

                if (y1 == y2) {
                  // fillrect is much faster
                  g.fillRect(x0 + x1, y0 - y1 - pass, x2 - x1, 1);
                } else {
                  Graphics2D g2d = (Graphics2D) g;
                  Stroke oldStroke = null;
                  if (seq.transitionStroke != null) {
                    oldStroke = g2d.getStroke();
                    g2d.setStroke(seq.transitionStroke);
                  }
                  g.drawLine(x0 + x1, y0 - y1 - pass, x0 + x2, y0 - y2 - pass);
                  if (oldStroke != null) {
                    g2d.setStroke(oldStroke);
                  }
                }
              }
            }
            x1 = x2;
            v1 = v2;
          }
        }

        // Current value
        long v = seq.value(seq.size - 1);
        if (v >= vMin && v <= vMax) {
          if (bgIsLight) {
            g.setColor(seq.color);
          } else {
            g.setColor(fg);
          }
          x = r.x + r.width + 2;
          y = topMargin + h - (int) (h * (v - vMin) / (vMax - vMin));
          // a small triangle/arrow
          g.fillPolygon(new int[] {x + 2, x + 6, x + 6}, new int[] {y, y + 3, y - 3}, 3);
        }
        g.setColor(fg);
      }
    }

    int[] valueStringSlots = new int[nLists];
    for (int i = 0; i < nLists; i++) valueStringSlots[i] = -1;
    for (int i = 0; i < nLists; i++) {
      Sequence seq = seqs.get(i);
      if (seq.isPlotted && seq.size > 0) {
        // Draw current value

        // TODO: collapse values if pointsPerPixel >= 4

        long v = seq.value(seq.size - 1);
        if (v >= vMin && v <= vMax) {
          x = r.x + r.width + 2;
          y = topMargin + h - (int) (h * (v - vMin) / (vMax - vMin));
          int y2 = getValueStringSlot(valueStringSlots, y, 2 * 10, i);
          g.setFont(smallFont);
          if (bgIsLight) {
            g.setColor(seq.color);
          } else {
            g.setColor(fg);
          }
          String curValue = getFormattedValue(v, true);
          if (unit == Unit.PERCENT) {
            curValue += "%";
          }
          int valWidth = fm.stringWidth(curValue);
          String legend = (displayLegend ? seq.name : "");
          int legendWidth = fm.stringWidth(legend);
          if (checkRightMargin(valWidth) || checkRightMargin(legendWidth)) {
            // Wait for next repaint
            return;
          }
          g.drawString(legend, x + 17, Math.min(topMargin + h, y2 + 3 - 10));
          g.drawString(curValue, x + 17, Math.min(topMargin + h + 10, y2 + 3));

          // Maybe draw a short line to value
          if (y2 > y + 3) {
            g.drawLine(x + 9, y + 2, x + 14, y2);
          } else if (y2 < y - 3) {
            g.drawLine(x + 9, y - 2, x + 14, y2);
          }
        }
        g.setFont(oldFont);
        g.setColor(fg);
      }
    }
    g.setColor(oldColor);
  }
コード例 #19
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Appends the specified menu item to the end of this menu.
  *
  * @param menuItem the <code>JMenuItem</code> to add
  * @return the <code>JMenuItem</code> added
  */
 public JMenuItem add(JMenuItem menuItem) {
   super.add(menuItem);
   return menuItem;
 }
コード例 #20
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
 /**
  * {@inheritDoc}
  *
  * @since 1.6
  */
 public void setFont(Font font) {
   super.setFont(font);
   updateLabelSizes();
 }
コード例 #21
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
 /**
  * Sets the UI object which implements the L&amp;F for this component.
  *
  * @param ui the SliderUI L&amp;F object
  * @see UIDefaults#getUI
  * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that
  *     implements the slider's LookAndFeel.
  */
 public void setUI(SliderUI ui) {
   super.setUI(ui);
 }
コード例 #22
0
  public AboutDialog(JConsole jConsole) {
    super(jConsole, Resources.getText("Help.AboutDialog.title"), false);

    setAccessibleDescription(this, getText("Help.AboutDialog.accessibleDescription"));
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setResizable(false);
    JComponent cp = (JComponent) getContentPane();

    createActions();

    JLabel mastheadLabel = new JLabel(mastheadIcon);
    setAccessibleName(mastheadLabel, getText("Help.AboutDialog.masthead.accessibleName"));

    JPanel mainPanel = new TPanel(0, 0);
    mainPanel.add(mastheadLabel, NORTH);

    String jConsoleVersion = Version.getVersion();
    String vmName = System.getProperty("java.vm.name");
    String vmVersion = System.getProperty("java.vm.version");
    String urlStr = getText("Help.AboutDialog.userGuideLink.url");
    if (isBrowseSupported()) {
      urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>";
    }

    JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10));
    infoAndLogoPanel.setBackground(bgColor);

    String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF);
    JEditorPane helpLink =
        new JEditorPane(
            "text/html",
            "<html><font color=#"
                + colorStr
                + ">"
                + getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion)
                + "<p>"
                + getText("Help.AboutDialog.javaVersion", (vmName + ", " + vmVersion))
                + "<p>"
                + getText("Help.AboutDialog.userGuideLink", urlStr)
                + "</html>");
    helpLink.setOpaque(false);
    helpLink.setEditable(false);
    helpLink.setForeground(textColor);
    mainPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    helpLink.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              browse(e.getDescription());
            }
          }
        });
    infoAndLogoPanel.add(helpLink, NORTH);

    ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource("resources/brandlogo.png"));
    JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING);

    JButton closeButton = new JButton(closeAction);

    JPanel bottomPanel = new TPanel(0, 0);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    buttonPanel.setOpaque(false);

    mainPanel.add(infoAndLogoPanel, CENTER);
    cp.add(bottomPanel, SOUTH);

    infoAndLogoPanel.add(brandLogo, SOUTH);

    buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12));
    buttonPanel.add(closeButton);
    bottomPanel.add(buttonPanel, NORTH);

    statusBar = new JLabel(" ");
    bottomPanel.add(statusBar, SOUTH);

    cp.add(mainPanel, NORTH);

    pack();
    setLocationRelativeTo(jConsole);
    Utilities.updateTransparency(this);
  }
コード例 #23
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Sets the L&F object that renders this component.
  *
  * @param ui the new <code>PopupMenuUI</code> L&F object
  * @see UIDefaults#getUI
  * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that
  *     implements the Component's LookAndFeel.
  */
 public void setUI(PopupMenuUI ui) {
   super.setUI(ui);
 }
コード例 #24
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /**
  * Sets the L&amp;F object that renders this component.
  *
  * @param ui the <code>LabelUI</code> L&amp;F object
  * @see UIDefaults#getUI
  * @beaninfo bound: true hidden: true expert: true attribute: visualUpdate true description: The
  *     UI object that implements the Component's LookAndFeel.
  * @since 1.3
  */
 public void setUI(RootPaneUI ui) {
   super.setUI(ui);
 }
コード例 #25
0
ファイル: JApplet.java プロジェクト: Cultivators/JDKResource
 /**
  * {@inheritDoc}
  *
  * @since 1.6
  */
 public Graphics getGraphics() {
   JComponent.getGraphicsInvoked(this);
   return super.getGraphics();
 }
コード例 #26
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 protected void processFocusEvent(FocusEvent evt) {
   super.processFocusEvent(evt);
 }
コード例 #27
0
ファイル: JRootPane.java プロジェクト: CodeingBoy/Java8CN
 /**
  * {@inheritDoc}
  *
  * @since 1.6
  */
 public void setDoubleBuffered(boolean aFlag) {
   if (isDoubleBuffered() != aFlag) {
     super.setDoubleBuffered(aFlag);
     RepaintManager.currentManager(this).doubleBufferingChanged(this);
   }
 }
コード例 #28
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Paints the popup menu's border if the <code>borderPainted</code> property is <code>true</code>.
  *
  * @param g the <code>Graphics</code> object
  * @see JComponent#paint
  * @see JComponent#setBorder
  */
 protected void paintBorder(Graphics g) {
   if (isBorderPainted()) {
     super.paintBorder(g);
   }
 }