/**
  * Initialize panels representing individual wizard's steps and sets various properties for them
  * influencing wizard appearance.
  */
 private WizardDescriptor.Panel[] getPanels() {
   if (panels == null) {
     panels =
         new WizardDescriptor.Panel[] {
           new RenderStemsWizardPanel1(),
           new RenderStemsWizardPanel2(),
           new RenderStemsWizardPanel3(),
           new RenderStemsWizardPanel4(),
           new RenderStemsWizardPanel5()
         };
     String[] steps = new String[panels.length];
     for (int i = 0; i < panels.length; i++) {
       Component c = panels[i].getComponent();
       // Default step name to component name of panel.
       steps[i] = c.getName();
       if (c instanceof JComponent) { // assume Swing components
         JComponent jc = (JComponent) c;
         // Sets step number of a component
         // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
         jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
         // Sets steps names for a panel
         jc.putClientProperty("WizardPanel_contentData", steps);
         // Turn on subtitle creation on each step
         jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
         // Show steps on the left side with the image on the background
         jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
         // Turn on numbering of all steps
         jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
       }
     }
   }
   return panels;
 }
 @Override
 public void initialize(final WizardDescriptor wiz) {
   this.wiz = wiz;
   index = 0;
   panels = createPanels();
   // Make sure list of steps is accurate.
   String[] steps = createSteps();
   for (int i = 0; i < panels.length; i++) {
     final Component c = panels[i].getComponent();
     if (steps[i] == null) {
       // Default step name to component name of panel.
       // Mainly useful for getting the name of the target
       // chooser to appear in the list of steps.
       steps[i] = c.getName();
     }
     if (c instanceof JComponent) { // assume Swing components
       final JComponent jc = (JComponent) c;
       // Step #.
       // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
       jc.putClientProperty("WizardPanel_contentSelectedIndex", Integer.valueOf(i));
       // Step name (actually the whole list for reference).
       jc.putClientProperty("WizardPanel_contentData", steps);
     }
   }
 }
  /**
   * Initialize panels representing individual wizard's steps and sets various properties for them
   * influencing wizard appearance.
   */
  private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() {
    if (panels == null) {
      panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
      panels.add(new AddImageWizardPanel1());
      panels.add(new AddImageWizardPanel2(action));
      panels.add(new AddImageWizardPanel3());
      panels.add(new AddImageWizardPanel4());

      String[] steps = new String[panels.size()];
      for (int i = 0; i < panels.size(); i++) {
        Component c = panels.get(i).getComponent();
        // Default step name to component name of panel.
        steps[i] = c.getName();
        if (c instanceof JComponent) { // assume Swing components
          JComponent jc = (JComponent) c;
          // Sets step number of a component
          jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
          // Sets steps names for a panel
          jc.putClientProperty("WizardPanel_contentData", steps);
          // Turn on subtitle creation on each step
          jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
          // Show steps on the left side with the image on the background
          jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
          // Turn on numbering of all steps
          jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
        }
      }
    }
    return panels;
  }
  @Override
  public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    index = 0;
    panels = createPanels();
    // Make sure list of steps is accurate.
    String[] steps = createSteps();
    for (int i = 0; i < panels.length; i++) {
      Component c = panels[i].getComponent();
      if (steps[i] == null) {
        // Default step name to component name of panel.
        // Mainly useful for getting the name of the target
        // chooser to appear in the list of steps.
        steps[i] = c.getName();
      }
      if (c instanceof JComponent) { // assume Swing components
        JComponent jc = (JComponent) c;
        // Step #.
        jc.putClientProperty(WizardProperties.SELECTED_INDEX, new Integer(i));
        // Step name (actually the whole list for reference).
        jc.putClientProperty(WizardProperties.CONTENT_DATA, steps);
      }
    }

    FileObject template = Templates.getTemplate(wiz);

    wiz.putProperty(WizardProperties.NAME, template.getName());
  }
 private void initPanel(BasicWizardPanel panel, WizardDescriptor wd, int i) {
   panel.setSettings(wd);
   JComponent jc = (JComponent) panel.getComponent();
   jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
   jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
   jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
   jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
   jc.putClientProperty(
       WizardDescriptor.PROP_CONTENT_DATA, new String[] {CHOOSER_STEP, INFO_STEP});
 }
 protected void adjustComponent(JComponent comp) {
   // comp.putClientProperty("Quaqua.Component.visualMargin", new Insets(0,0,0,0));
   Font font = UIManager.getFont("SmallSystemFont");
   if (font != null) {
     comp.setFont(font);
   }
   comp.putClientProperty("JComponent.sizeVariant", "small");
   if (comp instanceof JButton) {
     comp.putClientProperty("JButton.buttonType", "roundRect");
   }
   if (comp instanceof JComboBox) {
     // comp.putClientProperty("JComboBox.isSquare", Boolean.TRUE);
   }
 }
  /** @inheritDoc */
  @Override
  protected void uninstallDefaults() {
    SeaGlassContext context = getContext(getComponent(), ENABLED);
    JComponent c = getComponent();
    c.putClientProperty("caretAspectRatio", null);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    Object clientProperty = c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
    if (clientProperty == localTrue) {
      c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.FALSE);
    }
    super.uninstallDefaults();
  }
 private void updateSteps() {
   String[] steps = new String[panels.size()];
   for (int i = 0; i < panels.size(); i++) {
     Component c = panels.get(i).getComponent();
     // Default step name to component name of panel.
     steps[i] = c.getName();
     if (c instanceof JComponent) { // assume Swing components
       JComponent jc = (JComponent) c;
       jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
       jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
       jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
       jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
       jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
     }
   }
 }
 protected void installDefaults() {
   // Installs the text cursor on the component
   super.installDefaults();
   JComponent c = getComponent();
   Object clientProperty = c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
   if (clientProperty == null || clientProperty == localFalse) {
     c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, localTrue);
   }
   updateStyle((JTextComponent) getComponent());
 }
示例#10
0
  public void add(SubWindow window) {
    if (!(window instanceof JComponent))
      throw new IllegalStateException(
          "window parameter must be an instance of SubWindow and JComponent");

    JComponent jc = (JComponent) window;
    jc.putClientProperty("SubWindow.id", window.getName());
    window.setListener(new SubWindowHandler());
    addTab(window.getTitle(), jc);
  }
  @Override
  public void actionPerformed(ActionEvent e) {
    List<WizardDescriptor.Panel<WizardDescriptor>> panels =
        new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
    panels.add(new NumberWizardPanel1());
    panels.add(new NumberWizardPanel2());
    panels.add(new NumberWizardPanel3());
    String[] steps = new String[panels.size()];
    for (int i = 0; i < panels.size(); i++) {
      Component c = panels.get(i).getComponent();
      // Default step name to component name of panel.
      steps[i] = c.getName();
      if (c instanceof JComponent) { // assume Swing components
        JComponent jc = (JComponent) c;
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
      }
    }
    WizardDescriptor wiz =
        new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wiz.setTitleFormat(new MessageFormat("{0}"));
    wiz.setTitle(Bundle.CTL_NumberDialogTitle());
    if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
      // do something
      StatusDisplayer.getDefault().setStatusText("Wizard Finished");

      // retrieve and display the numbers
      StringBuilder message = new StringBuilder("Number Sequence =  \n(");
      message.append(wiz.getProperty(NumberVisualPanel1.PROP_FIRST_NUMBER)).append(", ");
      message.append(wiz.getProperty(NumberVisualPanel2.PROP_SECOND_NUMBER)).append(", ");
      message.append(wiz.getProperty(NumberVisualPanel3.PROP_THIRD_NUMBER)).append(")");

      DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message.toString()));

    } else {
      StatusDisplayer.getDefault().setStatusText("Wizard Canceled");
    }
  }
  @Override
  public void actionPerformed(ActionEvent ev) {
    List<WizardDescriptor.Panel<WizardDescriptor>> panels =
        new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
    panels.add(new CreateModelWizardName());
    panels.add(new CreateModelWizardFields());
    String[] steps = new String[panels.size()];
    for (int i = 0; i < panels.size(); i++) {
      Component c = panels.get(i).getComponent();
      // Default step name to component name of panel.
      steps[i] = c.getName();
      if (c instanceof JComponent) { // assume Swing components
        JComponent jc = (JComponent) c;
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
      }
    }
    WizardDescriptor wiz =
        new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wiz.setTitleFormat(new MessageFormat("{0}"));
    wiz.setTitle("Create Model");
    // wiz.putProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.FALSE);
    wiz.putProperty(
        WizardDescriptor.PROP_IMAGE,
        ImageUtilities.loadImage("org/netbeans/modules/trintejs/images/trintejs-banner.png", true));

    if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
      String modelName = (String) wiz.getProperty("modelName");
      String[] modelFields = (String[]) wiz.getProperty("modelFields");
      // System.out.println(Arrays.toString(modelFields));
      URL template = CreateModelAction.class.getResource(TEMPLATE);

      System.out.println("template: " + template.toString());
      // WriteFileFromTemplate.modelFile(context, template, modelName, modelFields);
      System.out.println("WizardDescriptor: FINISH_OPTION");
    }
    System.out.println("CreateModelAction: ActionPerformed");
  }
示例#13
0
  // installs a private instance of GestureHandler, if necessary
  static void addGestureListenerTo(final JComponent component, final GestureListener listener) {
    final Object value = component.getClientProperty(CLIENT_PROPERTY);
    if (value instanceof GestureHandler) {
      ((GestureHandler) value).addListener(listener);
      return;
    }

    if (value != null) return; // some other garbage is in our client property

    final GestureHandler newHandler = new GestureHandler();
    newHandler.addListener(listener);
    component.putClientProperty(CLIENT_PROPERTY, newHandler);
  }
  /**
   * DOCUMENT ME!
   *
   * @return DOCUMENT ME!
   */
  private WizardDescriptor.Panel[] getPanels() {
    assert EventQueue.isDispatchThread() : "can only be called from EDT"; // NOI18N

    if (panels == null) {
      panels =
          new WizardDescriptor.Panel[] {
            new ImportGeoCPMWizardPanelCFGSelect(),
            new ImportGeoCPMWizardPanelMetadata(),
            new ImportGeoCPMWizardPanelUpload()
          };

      final String[] steps = new String[panels.length];
      for (int i = 0; i < panels.length; i++) {
        final Component c = panels[i].getComponent();
        // Default step name to component name of panel. Mainly useful
        // for getting the name of the target chooser to appear in the
        // list of steps.
        steps[i] = c.getName();
        if (c instanceof JComponent) {
          // assume Swing components
          final JComponent jc = (JComponent) c;
          // Sets step number of a component
          jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i));
          // Sets steps names for a panel
          jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
          // Turn on subtitle creation on each step
          jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);
          // Show steps on the left side with the image on the
          // background
          jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE);
          // Turn on numbering of all steps
          jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE);
        }
      }
    }

    return panels;
  }
 @Override
 protected void applyBackground(Component renderer, ComponentAdapter adapter) {
   if (!adapter.isSelected()) {
     Object colorMemory =
         ((JComponent) renderer).getClientProperty("rendererColorMemory.background");
     if (colorMemory instanceof ColorMemory) {
       renderer.setBackground(((ColorMemory) colorMemory).color);
     } else {
       ((JComponent) renderer)
           .putClientProperty(
               "rendererColorMemory.background", new ColorMemory(renderer.getBackground()));
     }
   }
 }
  public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    FileObject template = Templates.getTemplate(wiz);
    preferredName = template.getName();
    this.wiz.putProperty("name", preferredName);
    platform = (String) template.getAttribute("platform");

    this.wiz = wiz;
    index = 0;
    panels = createPanels();
    // Make sure list of steps is accurate.
    String[] steps = createSteps();
    for (int i = 0; i < panels.length; i++) {
      Component c = panels[i].getComponent();
      if (steps[i] == null) {
        // Default step name to component name of panel.
        // Mainly useful for getting the name of the target
        // chooser to appear in the list of steps.
        steps[i] = c.getName();
      }
      if (c instanceof JComponent) { // assume Swing components
        JComponent jc = (JComponent) c;
        // Step #.
        jc.putClientProperty(
            WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, new Integer(i)); // NOI18N
        // Step name (actually the whole list for reference).
        jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); // NOI18N
        /*
         * Fix for #147260 - Wrong title in Ricoh samples wizard
         */
        jc.putClientProperty(
            "NewProjectWizard_Title",
            NbBundle.getMessage(NewProjectIterator.class, "TXT_SampleProject")); // NOI18N
      }
    }
    this.wiz.putProperty("additionalProperties", new Properties());
  }
    public boolean verify(JComponent input) {
      JTextComponent jtc = (JTextComponent) input;
      if (!jtc.isEnabled()) return true;
      if (!jtc.isEditable()) return true;

      Number num = self.value;
      if (num != null) {
        try {
          checkRange(num);
        } catch (Exception ex) {
          input.putClientProperty("Verification-Error", ex.getMessage());
          // tooltip.setText(ex.getMessage());
          // tooltip.show(input);
          return false;
        }
      } else if (jtc.getText() != null && jtc.getText().length() > 0) {
        jtc.setText("");
      }

      input.putClientProperty("Verification-Error", null);
      // tooltip.hide();
      self.finalizeValue();
      return true;
    }
示例#18
0
  @Override
  protected JComponent createExtComponent() {

    JTextComponent component = getComponent();

    // Add the scroll-pane with the component to the center
    JScrollPane scroller = new JScrollPane(component);
    scroller.getViewport().setMinimumSize(new Dimension(4, 4));

    // remove default scroll-pane border, winsys will handle borders itself
    Border empty = BorderFactory.createEmptyBorder();
    // Important:  Do not delete or use null instead, will cause
    // problems on GTK L&F.  Must set both scroller border & viewport
    // border! - Tim
    scroller.setBorder(empty);
    scroller.setViewportBorder(empty);

    if (component.getClientProperty("nbeditorui.vScrollPolicy") != null) {
      scroller.setVerticalScrollBarPolicy(
          (Integer) component.getClientProperty("nbeditorui.vScrollPolicy"));
    }
    if (component.getClientProperty("nbeditorui.hScrollPolicy") != null) {
      scroller.setHorizontalScrollBarPolicy(
          (Integer) component.getClientProperty("nbeditorui.hScrollPolicy"));
    }
    // extComponent will be a panel
    JComponent ec = new JPanel(new BorderLayout());
    ec.putClientProperty(JTextComponent.class, component);
    ec.add(scroller);

    // Initialize sidebars
    // Need to clear the cache - it's null at this point when opening file but the sidebars
    // would be reused during L&F change (see BaseTextUI.UIWatcher) which would not work properly.
    CustomizableSideBar.resetSideBars(component);
    Map<SideBarPosition, JComponent> sideBars = CustomizableSideBar.getSideBars(component);
    processSideBars(sideBars, ec);

    if (listener == null) {
      listener = new SideBarsListener(component);
      CustomizableSideBar.addChangeListener(NbEditorUtilities.getMimeType(component), listener);
    }

    // Initialize the corner component
    initGlyphCorner(scroller);

    return ec;
  }
示例#19
0
  public void assertIsDispatchThread(@Nullable final JComponent component) {
    if (component == null) return;

    Thread curThread = Thread.currentThread();
    if (ourDispatchThread == curThread) {
      return;
    }

    if (Boolean.TRUE.equals(component.getClientProperty(WAS_EVER_SHOWN))) {
      assertIsDispatchThread();
    } else {
      final JRootPane root = component.getRootPane();
      if (root != null) {
        component.putClientProperty(WAS_EVER_SHOWN, Boolean.TRUE);
        assertIsDispatchThread();
      }
    }
  }
示例#20
0
  protected synchronized void updateFileListComponents() {
    throbber.setVisible(!finishedSearch);
    removeAll();
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = getColumnCount() - 1;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.EAST;
    add(throbber, c);

    c.gridx = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.BOTH;
    if (constrainedList.getSize() == 0) {
      if (finishedSearch) {
        add(emptyLabel, c);
      } else {
        add(searchingLabel, c);
      }
    }

    for (int a = 0; a < constrainedList.getSize(); a++) {
      File file = constrainedList.getElementAt(a);
      JComponent jc = componentCache.get(file);
      if (jc == null) {
        jc = createComponent(file);
        jc.putClientProperty(KEY_FILE, file);
        componentCache.put(file, jc);
      }

      add(jc, c);
      c.gridx = (c.gridx + 1) % getColumnCount();
      if (c.gridx == 0) c.gridy++;
    }
    c.gridy++;
    c.weighty = 1;
    add(fluff, c);

    revalidate();
    repaint();
  }
示例#21
0
    public void fireUpdate(SubWindow window) {
      if (window == null) return;
      if (!(window instanceof Component))
        throw new IllegalStateException(
            "window parameter must be an instance of SubWindow and Component");

      JComponent jc = (JComponent) window;
      int index = indexOfComponent(jc);
      if (index < 0) return;

      setTitleAt(index, window.getTitle() + "          ");
      String newId = window.getName();
      String oldId = jc.getClientProperty("SubWindow.id") + "";
      if (oldId != null && newId != null && !oldId.equals(newId)) {
        tabIndex.remove(oldId);
        tabIndex.put(newId, jc);
      }
      jc.putClientProperty("SubWindow.id", newId);
    }
 private synchronized void putState(JComponent component, Part part, State state) {
   component.putClientProperty(PartUIClientPropertyKey.getKey(part), state);
 }
示例#23
0
  /**
   * @ÃèÊö£º.
   *
   * <p>
   *
   * @author ÀîÍþ @Date£º2011-3-12
   * @param args
   */
  public static void main(String[] args) {
    FlexLayoutTest frame = new FlexLayoutTest();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setSize(1000, 600);
    frame.setPreferredSize(new Dimension(1000, 600));
    // Container contentPane = frame.getContentPane();
    JComponent contentPane = (JComponent) frame.getContentPane();
    contentPane.setLayout(new FlexLayout());
    contentPane.putClientProperty(
        LayoutProperty.LAYOUT_PARENT_PROPERTY, new LayoutProperty(0, 0, 1000, 600));
    JButton btn1 = new JButton("AAA");
    btn1.setBorder(new JButtonBorder());
    JButton btn2 = new JButton("BBB");
    JButton btn3 = new JButton("CCC");
    JButton btn4 = new JButton("DDD");
    JButton btn5 = new JButton("EEE");
    JButton btn6 = new JButton("FFF");
    JTextArea area = new JTextArea();
    btn1.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            10,
            10,
            300,
            30,
            LayoutProperty.TOP | LayoutProperty.LEFT | LayoutProperty.RIGHT_RESIZE));
    btn2.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            350,
            10,
            300,
            30,
            LayoutProperty.TOP | LayoutProperty.LEFT_RESIZE | LayoutProperty.RIGHT_RESIZE));
    btn3.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            690,
            10,
            300,
            30,
            LayoutProperty.TOP | LayoutProperty.LEFT_RESIZE | LayoutProperty.RIGHT));

    btn4.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            10,
            560,
            300,
            30,
            LayoutProperty.BOTTOM | LayoutProperty.LEFT | LayoutProperty.RIGHT_RESIZE));
    btn5.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            350,
            560,
            300,
            30,
            LayoutProperty.BOTTOM | LayoutProperty.LEFT_RESIZE | LayoutProperty.RIGHT_RESIZE));
    btn6.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            690,
            560,
            300,
            30,
            LayoutProperty.BOTTOM | LayoutProperty.LEFT_RESIZE | LayoutProperty.RIGHT));

    area.putClientProperty(
        LayoutProperty.LAYOUT_CHILD_PROPERTY,
        new LayoutProperty(
            10,
            52,
            980,
            498,
            LayoutProperty.TOP
                | LayoutProperty.LEFT
                | LayoutProperty.RIGHT
                | LayoutProperty.BOTTOM));
    area.setBackground(Color.DARK_GRAY);
    area.setForeground(Color.RED);
    frame.add(btn1);
    frame.add(btn2);
    frame.add(btn3);
    frame.add(btn4);
    frame.add(btn5);
    frame.add(btn6);
    frame.add(area);

    JMenu menu = new JMenu("File");
    JMenuItem menuItem = new JMenuItem("Exit Application");
    menuItem.setBorder(new JMenuItemBorder());
    menu.add(menuItem);

    JMenuItem menuItem1 = new JMenuItem("Exit Application");
    menuItem1.setBorder(new JMenuItemBorder());
    menu.add(menuItem1);

    JMenuItem menuItem2 = new JMenuItem("Exit Application");
    menuItem2.setBorder(new JMenuItemBorder());
    menu.add(menuItem2);

    JMenuBar bar = new JMenuBar();
    bar.add(menu);
    frame.setJMenuBar(bar);

    frame.setVisible(true);
  }
 protected void updateClientProperty(JComponent component, String property) {
   Point p = (Point) component.getClientProperty(property);
   if (p == null || (rollover.x != p.x) || (rollover.y != p.y)) {
     component.putClientProperty(property, new Point(rollover));
   }
 }
示例#25
0
 public void setFillColumn(JComponent c, boolean b) {
   c.putClientProperty("VariableGridLayout.fillColumn", b);
 }
 public static void suppressMacCornerFor(JComponent popupComponent) {
   popupComponent.putClientProperty(SUPPRESS_MAC_CORNER, Boolean.TRUE);
 }
示例#27
0
 @Override
 public void removeLayoutComponent(Component c) {
   ((JComponent) c).putClientProperty(iPlatformComponent.RARE_SWING_WIDTH_FIXED_VALUE, null);
   ((JComponent) c).putClientProperty(iPlatformComponent.RARE_SWING_HEIGHT_FIXED_VALUE, null);
   super.removeLayoutComponent(c);
 }
示例#28
0
 @Override
 public void addLayoutComponent(String name, Component c) {
   ((JComponent) c).putClientProperty(iPlatformComponent.RARE_SWING_WIDTH_FIXED_VALUE, null);
   ((JComponent) c).putClientProperty(iPlatformComponent.RARE_SWING_HEIGHT_FIXED_VALUE, null);
   super.addLayoutComponent(name, c);
 }
示例#29
0
 /**
  * Specify that the given component will take the remaining vertical space while creating the
  * layout of this <code>GroupBox</code>.
  *
  * @param component One of the child of this <code>GroupBox</code>, which needs the vertical space
  */
 public static void fillVertical(JComponent component) {
   component.putClientProperty(FILL_VERTICAL, Boolean.TRUE);
 }