Package org.nlogo.window

Examples of org.nlogo.window.Widget


  // new widgets in the UI.  For most widget types, the same type string
  // is used in both places. - ST 3/17/04
  @Override
  public Widget makeWidget(String type, boolean loading) {
    type = type.toUpperCase();
    Widget fromRegistry = org.nlogo.window.WidgetRegistry.apply(type);
    if (fromRegistry != null) {
      return fromRegistry;
    } else if (type.equalsIgnoreCase("SLIDER")) {
      return new org.nlogo.window.SliderWidget(workspace.world.auxRNG) {
        @Override
View Full Code Here


                .view,
               zoomFactor(), 1.0, false);
      }
      return viewWidget.asWidget();
    } else {
      Widget newGuy = null;
      newGuy = makeWidget(type, true);
      if (newGuy != null) {
        newGuy.load(strings, helper);
        enforceMinimumAndMaximumWidgetSizes(newGuy);
        addWidget(newGuy, x, y, false, true);
      }
      return newGuy;
    }
View Full Code Here

    // loop backwards so JLayeredPane gives us the components
    // in back-to-front order for saving - ST 9/29/03
    for (int i = comps.length - 1; i >= 0; i--) {
      if (comps[i] instanceof WidgetWrapper) {
        WidgetWrapper wrapper = (WidgetWrapper) comps[i];
        Widget widget = wrapper.widget();
        if (!result.contains(widget)) {
          result.add(widget);
        }
      }
    }
View Full Code Here

  @Override
  public boolean isFocusable() {
    java.awt.Component[] comps = getComponents();
    for (int i = 0; i < comps.length; i++) {
      if (comps[i] instanceof WidgetWrapper) {
        Widget widget = ((WidgetWrapper) comps[i]).widget();
        if (widget instanceof org.nlogo.window.InputBoxWidget) {
          return true;
        }
        if (widget instanceof org.nlogo.window.ButtonWidget) {
          org.nlogo.window.ButtonWidget button =
View Full Code Here

  private org.nlogo.window.ButtonWidget findActionButton(char key) {
    java.awt.Component[] comps = getComponents();
    for (int i = 0; i < comps.length; i++) {
      if (comps[i] instanceof WidgetWrapper) {
        Widget widget = ((WidgetWrapper) comps[i]).widget();
        if (widget instanceof org.nlogo.window.ButtonWidget) {
          org.nlogo.window.ButtonWidget button =
              (org.nlogo.window.ButtonWidget) widget;
          if (Character.toUpperCase(button.actionKey()) ==
              Character.toUpperCase(key)) {
View Full Code Here

  private void enableButtonKeys(boolean enabled) {
    java.awt.Component[] comps = getComponents();
    for (int i = 0; i < comps.length; i++) {
      if (comps[i] instanceof WidgetWrapper) {
        Widget widget = ((WidgetWrapper) comps[i]).widget();
        if (widget instanceof org.nlogo.window.ButtonWidget) {
          org.nlogo.window.ButtonWidget button =
              (org.nlogo.window.ButtonWidget) widget;
          button.keyEnabled(enabled);
        }
View Full Code Here

    WidgetCreationMenuItem(final String displayName, final String widgetType, final int x, final int y) {
      super(displayName);
      addActionListener
          (new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
              Widget widget = makeWidget(widgetType, false);
              WidgetWrapper wrapper = addWidget(widget, x, y, true, false);
              revalidate();
              wrapper.selected(true);
              wrapper.foreground();
              wrapper.isNew(true);
View Full Code Here

    unselectWidgets();
    startDragPoint = e.getPoint();
    if (widgetCreator == null) {
      return;
    }
    Widget widget = widgetCreator.getWidget();
    if (widget == null) {
      return;
    }
    addWidget(widget, e.getX(), e.getY(), true, false);
    revalidate();
View Full Code Here

          });
    }
  }

  public void createWidget(String name, int x, int y) {
    Widget widget = makeWidget(name, false);
    WidgetWrapper wrapper = addWidget(widget, x, y, true, false);
    revalidate();
    wrapper.selected(true);
    wrapper.foreground();
    wrapper.isNew(true);
View Full Code Here

  // This is used both when loading a model and when the user is making
  // new widgets in the UI.  For most widget types, the same type string
  // is used in both places. - ST 3/17/04
  public Widget makeWidget(String type, boolean loading) {
    type = "DUMMY " + type.toUpperCase();
    Widget fromRegistry = org.nlogo.window.WidgetRegistry.apply(type);
    if (fromRegistry != null) {
      return fromRegistry;
    } else if (type.equals("DUMMY SLIDER")) {
      return new org.nlogo.window.DummySliderWidget();
    } else if (type.equals("DUMMY CHOOSER") || // current name
View Full Code Here

TOP

Related Classes of org.nlogo.window.Widget

Copyright © 2018 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.