Ejemplo n.º 1
0
    public void setMenu()
    {
        Menu fileMenu = new Menu("File");
        openItem = new MenuItem("Open");
        openItem.addActionListener(this);
        fileMenu.add(openItem);

        exitItem = new MenuItem("Exit");
        exitItem.addActionListener(this);
        fileMenu.add(exitItem);        
        
        Menu processMenu = new Menu("PictureTreatment");
        grayItem = new MenuItem("gray level treatment");
        grayItem.addActionListener(this);
        processMenu.add(grayItem);
        
        processMenu.addSeparator();        
        contrastItem = new MenuItem("contrast level treatment");
        contrastItem.addActionListener(this);
        processMenu.add(contrastItem);        
            
        MenuBar menuBar = new MenuBar();
        menuBar.add(fileMenu);
        menuBar.add(processMenu);
        setMenuBar(menuBar);      
    }
Ejemplo n.º 2
0
 public boolean onCreateOptionsMenu(Menu menu) {
   menu.add(0, START_LIVE_DATA, 0, "Start Live Data");
   menu.add(0, COMMAND_ACTIVITY, 0, "Run Command");
   menu.add(0, STOP_LIVE_DATA, 0, "Stop");
   menu.add(0, SETTINGS, 0, "Settings");
   return true;
 }
Ejemplo n.º 3
0
  public void fillMenuOptions(Menu menu, int instance) {
    boolean haveContext = false;
    boolean hasMiniMenu = false;

    if ((instance == Menu.INSTANCE_CONTEXT) || (pushMiniMenu)) {
      for (int i = 0; i < m_MiniMenuItems.size(); ++i) {
        MenuItem item = (MenuItem) m_MiniMenuItems.elementAt(i);
        if (item != null) {
          menu.add(item);
          hasMiniMenu = true;
        }
      }
    }

    if (!hasMiniMenu) {
      for (int i = 0; i < m_contextMenuItems.size(); ++i) {
        MenuItem item = (MenuItem) m_contextMenuItems.elementAt(i);
        if (item != null) {
          menu.add(item);
          haveContext = true;
        }
      }
    }

    if (((!haveContext) && (!hasMiniMenu))) {
      for (int i = 0; i < m_menuItems.size(); ++i) {
        menu.add((MenuItem) m_menuItems.elementAt(i));
      }
    }
  }
Ejemplo n.º 4
0
  //
  //  Initialize the GUI (application and applet)
  //
  public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D Light Scoping Example");

    //
    //  Add a menubar menu to change node parameters
    //    Use bounding leaf
    //

    Menu m = new Menu("DirectionalLights");

    light1OnOffMenu = new CheckboxMenuItem("Red light with sphere set 1 scope", light1OnOff);
    light1OnOffMenu.addItemListener(this);
    m.add(light1OnOffMenu);

    light2OnOffMenu = new CheckboxMenuItem("Blue light with sphere set 2 scope", light2OnOff);
    light2OnOffMenu.addItemListener(this);
    m.add(light2OnOffMenu);

    light3OnOffMenu = new CheckboxMenuItem("White light with universal scope", light3OnOff);
    light3OnOffMenu.addItemListener(this);
    m.add(light3OnOffMenu);

    exampleMenuBar.add(m);
  }
Ejemplo n.º 5
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   MenuInflater menuInflater = getMenuInflater();
   menuInflater.inflate(R.menu.main_menu, menu);
   menu.add("添加").setIcon(R.drawable.menu_add);
   menu.add("帮助").setIcon(R.drawable.menu_help);
   menu.add("联系").setIcon(R.drawable.menu_contact);
   return super.onCreateOptionsMenu(
       menu); // To change body of overridden methods use File | Settings | File Templates.
 }
Ejemplo n.º 6
0
 public CutAndPaste() {
   cut.addActionListener(new CutL());
   copy.addActionListener(new CopyL());
   paste.addActionListener(new PasteL());
   edit.add(cut);
   edit.add(copy);
   edit.add(paste);
   mb.add(edit);
   setMenuBar(mb);
   add(text, BorderLayout.CENTER);
 }
  /** Adds the menu represented by the node */
  private void addVisualMenu(RADMenuItemComponent comp) {
    Object o = getBeanInstance();
    Object m = comp.getBeanInstance();
    Object dto = getDesignTimeMenus(getFormManager()).getDesignTime(o);
    Object dtm = getDesignTimeMenus(getFormManager()).getDesignTime(m);

    switch (getMenuItemType()) {
      case T_MENUBAR:
        ((MenuBar) o).add((Menu) m);
        ((JMenuBar) dto).add((JMenu) dtm);
        ((JMenuBar) dto).validate();
        break;
      case T_MENU:
        if (comp.getMenuItemType() == T_SEPARATOR) {
          ((Menu) o).addSeparator();
          ((JMenu) dto).addSeparator();
        } else {
          ((Menu) o).add((MenuItem) m);
          ((JMenu) dto).add((JMenuItem) dtm);
        }
        break;
      case T_POPUPMENU:
        if (comp.getMenuItemType() == T_SEPARATOR) {
          ((Menu) o).addSeparator();
          ((JMenu) dto).addSeparator();
        } else {
          ((Menu) o).add((MenuItem) m);
          ((JPopupMenu) dto).add((JMenuItem) dtm);
        }
        break;
      case T_JMENUBAR:
        ((JMenuBar) o).add((JMenu) m);
        ((JMenuBar) o).validate();
        break;
      case T_JMENU:
        if (comp.getMenuItemType() == T_JSEPARATOR) {
          ((JMenu) o).addSeparator();
        } else {
          ((JMenu) o).add((JMenuItem) m);
        }
        break;
      case T_JPOPUPMENU:
        if (comp.getMenuItemType() == T_JSEPARATOR) {
          ((JPopupMenu) o).addSeparator();
        } else {
          ((JPopupMenu) o).add((JMenuItem) m);
        }
        break;
    }
  }
 @Override
 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
   menu.add(0, 0, 0, getString(R.string.hand_in_label))
       .setIcon(R.drawable.icon_retreive)
       .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
   return true;
 }
Ejemplo n.º 9
0
  public SplashDemo() throws NullPointerException, IllegalStateException, IOException {
    super("SplashScreen demo");
    setSize(300, 200);
    setLayout(new BorderLayout());
    Menu m1 = new Menu("File");
    MenuItem mi1 = new MenuItem("Exit");
    m1.add(mi1);
    mi1.addActionListener(this);
    this.addWindowListener(closeWindow);

    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    mb.add(m1);
    final SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
      System.out.println("SplashScreen.getSplashScreen() returned null");
      return;
    }
    Graphics2D g = splash.createGraphics();
    if (g == null) {
      System.out.println("g is null");
      return;
    }
    for (int i = 0; i < 100; i++) {
      renderSplashFrame(g, i);
      splash.update();
      try {
        Thread.sleep(90);
      } catch (InterruptedException e) {
      }
    }
    splash.close();
    setVisible(true);
    toFront();
  }
Ejemplo n.º 10
0
  /**
   * Shows "call via" menu allowing user to selected from multiple providers.
   *
   * @param context the android context
   * @param v the View that will contain the popup menu.
   * @param destination target callee name.
   */
  private static void showCallViaMenu(final Context context, View v, final String destination) {
    PopupMenu popup = new PopupMenu(context, v);

    Menu menu = popup.getMenu();

    Iterator<ProtocolProviderService> registeredProviders =
        AccountUtils.getRegisteredProviders().iterator();

    while (registeredProviders.hasNext()) {
      final ProtocolProviderService provider = registeredProviders.next();
      String accountAddress = provider.getAccountID().getAccountAddress();

      MenuItem menuItem = menu.add(Menu.NONE, Menu.NONE, Menu.NONE, accountAddress);

      menuItem.setOnMenuItemClickListener(
          new MenuItem.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {
              createCall(context, destination, provider);

              return false;
            }
          });
    }

    popup.show();
  }
Ejemplo n.º 11
0
  public MagicRobot(
      double first,
      double second,
      EasyFrame frameIn) // this is constructor as it has the same name as the class
      {

    frameIn.setMenuBar(menu);
    menu.add(functions);
    menu.add(colors);

    parentFrame = frameIn;
    add(colorButton);
    colorButton.addActionListener(this);

    number1 = first;
    number2 = second;
    // add visual components
    functions.add(addButton);
    functions.add(subtractButton);
    functions.add(multButton);
    functions.add(divideButton);
    functions.add(remButton);
    colors.add(blueButton);
    colors.add(greenButton);
    subtractButton.addActionListener(this);
    addButton.addActionListener(this);
    multButton.addActionListener(this);
    divideButton.addActionListener(this);
    remButton.addActionListener(this);
    blueButton.addActionListener(this);
    greenButton.addActionListener(this);
  }
Ejemplo n.º 12
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   final MenuItem item =
       menu.add(0, 1, Menu.NONE, myResource.getResource("menu").getResource("search").getValue());
   item.setOnMenuItemClickListener(this);
   item.setIcon(R.drawable.ic_menu_search);
   return true;
 }
Ejemplo n.º 13
0
 private void setupMenu() {
   menu.add(ActionFactory.getMovementFromDeckToWaste(moveController));
   menu.add(ActionFactory.getMovementFromFoundationToPile(moveController));
   menu.add(ActionFactory.getMovementFromPileToFoundation(moveController));
   menu.add(ActionFactory.getMovementFromPileToPile(moveController));
   menu.add(ActionFactory.getMovementFromWasteToDeck(moveController));
   menu.add(ActionFactory.getMovementFromWasteToFoundation(moveController));
   menu.add(ActionFactory.getMovementFromWasteToPile(moveController));
   menu.add(ActionFactory.getMovementDiscover(moveController));
 }
Ejemplo n.º 14
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    menu.add(0, SAVE_ID, 0, R.string.menu_save)
        .setIcon(R.drawable.save)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, LOCK_ID, 0, R.string.menu_item_lock)
        .setIcon(R.drawable.lock)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, DELETE_ID, 0, R.string.menu_delete)
        .setIcon(R.drawable.delete)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, SHARE_ID, 0, R.string.menu_share)
        .setIcon(R.drawable.share)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, SMALLER_ID, 0, R.string.menu_smaller)
        .setIcon(R.drawable.smaller)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, BIGGER_ID, 0, R.string.menu_bigger)
        .setIcon(R.drawable.bigger)
        .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    return true;
  }
Ejemplo n.º 15
0
  public static void main(String args[]) {
    vtkStructuredPointsReader reader = null;
    vtkActor isoActor = null;
    vtkPolyDataMapper isoMapper = null;

    MriIso f = new MriIso();
    f.vPanel = new vtkPanel2();
    f.vPanel.resize(400, 400);
    // f.savetofile = true;

    System.out.println("Here we go");

    reader = new vtkStructuredPointsReader();
    reader.SetFileName("MRIdata.vtk");

    f.cFilt = new vtkContourFilter();
    f.cFilt.SetValue(0, 225);
    f.cFilt.SetInput(reader.GetOutput());

    isoMapper = new vtkPolyDataMapper();
    isoMapper.SetInput(f.cFilt.GetOutput());

    isoActor = new vtkActor();
    isoActor.SetMapper(isoMapper);

    f.vPanel.GetRenderer().AddActor(isoActor);

    f.add("Center", f.vPanel);
    f.pack();

    // Set up the menu
    MenuBar mb = new MenuBar();
    Menu file = new Menu("File");
    file.add(new MenuItem("Animate"));
    file.add(new MenuItem("Exit"));
    mb.add(file);
    f.setMenuBar(mb);

    f.show();
  }
Ejemplo n.º 16
0
  private Menu createFileMenu() {
    Menu fileMenu = new Menu("File");
    fileMenu.add(quitItem = new MenuItem("Quit"));

    quitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            dispose();
            System.exit(0);
          }
        });
    return fileMenu;
  }
  /**
   * Method declaration
   *
   * @param f
   * @param m
   */
  void addMenuItems(Menu f, String m[]) {

    for (int i = 0; i < m.length; i++) {
      MenuItem item = new MenuItem(m[i].substring(1));
      char c = m[i].charAt(0);

      if (c != '-') {
        item.setShortcut(new MenuShortcut(c));
      }

      item.addActionListener(this);
      f.add(item);
    }
  }
Ejemplo n.º 18
0
  //
  //  Initialize the GUI (application and applet)
  //
  public void initialize(String[] args) {
    // Initialize the window, menubar, etc.
    super.initialize(args);
    exampleFrame.setTitle("Java 3D LinearFog Example");

    //
    //  Add a menubar menu to change node parameters
    //    Coupled background color
    //    Background color -->
    //    Fog color -->
    //    Fog front distance -->
    //    Fog back distance -->
    //

    Menu m = new Menu("LinearFog");

    coupledBackgroundOnOffMenu =
        new CheckboxMenuItem("Couple background color", coupledBackgroundOnOff);
    coupledBackgroundOnOffMenu.addItemListener(this);
    m.add(coupledBackgroundOnOffMenu);

    backgroundColorMenu =
        new CheckboxMenu("Background color", colors, currentBackgroundColor, this);
    m.add(backgroundColorMenu);
    backgroundColorMenu.setEnabled(!coupledBackgroundOnOff);

    colorMenu = new CheckboxMenu("Fog color", colors, currentColor, this);
    m.add(colorMenu);

    frontMenu = new CheckboxMenu("Fog front distance", fronts, currentFront, this);
    m.add(frontMenu);

    backMenu = new CheckboxMenu("Fog back distance", backs, currentBack, this);
    m.add(backMenu);

    exampleMenuBar.add(m);
  }
Ejemplo n.º 19
0
  public saiawtmenu(String title) {
    super(title);
    MenuBar mb = new MenuBar();
    Menu m = new Menu("File");
    Menu e = new Menu("Edit");
    m.add(new MenuItem("New"));
    m.add(new MenuItem("Open", new MenuShortcut('O')));
    m.add(new MenuItem("Print", new MenuShortcut('p')));

    m.addSeparator();
    m.add(new MenuItem("Save"));
    m.add(new MenuItem("Save As"));
    e.add(new MenuItem("Cut"));
    e.add(new MenuItem("Copy"));
    e.add(new MenuItem("Paste"));
    mb.add(m);
    mb.add(e);
    setMenuBar(mb);
  }
  public static void startApplet(
      Applet applet, String title, Hashtable params, int width, int height) {

    applet1 = applet;
    // setup so as getParameter, etc, will work
    OurAppletContext newAppletContext = new OurAppletContext(applet.getToolkit());
    OurAppletStub newAppletStub = new OurAppletStub(newAppletContext, params);
    applet.setStub(newAppletStub);

    // create new application frame window
    AppletFrame f = new AppletFrame(title + extraTitle);

    // add applet to frame window
    f.add("Center", applet);

    // add a quit menu item
    MenuBar menubar = new MenuBar();
    Menu file = new Menu("File", true);
    MenuItem item = new MenuItem("Quit");
    menubar.add(file);
    file.add(item);
    f.setMenuBar(menubar);
    item.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // At this point, we simply leave.
            java.lang.Runtime.getRuntime().exit(0);
          }
        });

    // resize frame window to fit applet
    f.pack();
    f.setSize(width, height);
    applet.setSize(width, height);

    // initialize the applet
    applet.init();
    applet.start();

    // show the window
    f.show();

    f.repaint();
  } // end startApplet()
Ejemplo n.º 21
0
 public static void main(String astring[]) {
   float f1 = 0.4F;
   float f2 = 0.4F;
   Ex63a ex63a = new Ex63a();
   vtkPanel VtkPanel = new vtkPanel();
   VtkPanel.setSize(400, 400);
   System.out.println("Here we go");
   vtkQuadric VtkQuadric = new vtkQuadric();
   VtkQuadric.SetCoefficients(1.0, 2.0, 3.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
   vtkSampleFunction VtkSampleFunction = new vtkSampleFunction();
   VtkSampleFunction.SetSampleDimensions(25, 25, 25);
   VtkSampleFunction.SetImplicitFunction(VtkQuadric);
   VtkSampleFunction.DebugOn();
   vtkContourFilter VtkContourFilter = new vtkContourFilter();
   VtkContourFilter.SetInput(VtkSampleFunction.GetOutput());
   VtkContourFilter.UseScalarTreeOn();
   VtkContourFilter.DebugOn();
   vtkPolyDataMapper VtkPolyDataMapper1 = new vtkPolyDataMapper();
   VtkPolyDataMapper1.SetInput(VtkContourFilter.GetOutput());
   VtkPolyDataMapper1.SetScalarRange(0.0, 7.0);
   vtkActor VtkActor1 = new vtkActor();
   VtkActor1.SetMapper(VtkPolyDataMapper1);
   VtkPanel.getRenderer().AddActor(VtkActor1);
   vtkOutlineFilter VtkOutlineFilter = new vtkOutlineFilter();
   VtkOutlineFilter.SetInput(VtkSampleFunction.GetOutput());
   vtkPolyDataMapper VtkPolyDataMapper2 = new vtkPolyDataMapper();
   VtkPolyDataMapper2.SetInput(VtkOutlineFilter.GetOutput());
   vtkActor VtkActor2 = new vtkActor();
   VtkActor2.SetMapper(VtkPolyDataMapper2);
   VtkActor2.GetProperty().SetColor(1.0, 1.0, 1.0);
   VtkPanel.getRenderer().AddActor(VtkActor2);
   ex63a.add("Center", VtkPanel);
   ex63a.pack();
   MenuBar menuBar = new MenuBar();
   Menu menu = new Menu("File");
   menu.add(new MenuItem("Exit"));
   menuBar.add(menu);
   ex63a.setMenuBar(menuBar);
   ex63a.show();
   for (float f3 = 0.0F; f3 < 12.0; f3++) {
     VtkContourFilter.SetValue(1, (double) (f1 + f3 * f2));
     VtkPanel.Render();
   }
 }
Ejemplo n.º 22
0
  private Menu createCascadingMenu() {
    Menu cascading = new Menu("Cascading", true);
    Menu submenu = new Menu("more", true);
    Menu subsubmenu = new Menu("yet more", true);

    submenu.add("submenu item 1");
    submenu.add("submenu item 2");
    submenu.add("submenu item 3");
    submenu.add("submenu item 4");
    submenu.add("submenu item 5");

    subsubmenu.add("subsubmenu item 1");
    subsubmenu.add("subsubmenu item 2");
    subsubmenu.add("subsubmenu item 3");
    subsubmenu.add("subsubmenu item 4");
    subsubmenu.add("subsubmenu item 5");

    submenu.add(subsubmenu);
    cascading.add(submenu);

    return cascading;
  }
Ejemplo n.º 23
0
  DigitalWatch() {
    super("DigitalWatch");

    setVisible(true);
    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    Menu menuDisp = new Menu("表示");
    mb.add(menuDisp);
    MenuItem itemProp = new MenuItem(Property.MENU_NAME);
    menuDisp.add(itemProp);
    itemProp.addActionListener(property);
    setBackground(property.getBackground());

    addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
  }
Ejemplo n.º 24
0
  /**
   * Creates a new QuestionTypeMenu. This Menu allows the user to choose a type of question to add
   * to a Survey/Test
   *
   * @param outputType
   * @param survey
   */
  public QuestionTypeMenu(String outputType, Survey survey) {
    super(outputType);
    this.survey = survey;

    MenuChoice addTF = new MenuChoice("Add new T/F question", 0);
    MenuChoice addMultChoice = new MenuChoice("Add new multiple choice question", 1);
    MenuChoice addEssay = new MenuChoice("Add new essay question", 2);
    MenuChoice addShortAns = new MenuChoice("Add new short answer question", 3);
    MenuChoice addRanking = new MenuChoice("Add new ranking question", 4);
    MenuChoice addMatching = new MenuChoice("Add new matching question", 5);
    MenuChoice back = new MenuChoice("Back", 6);
    // Adding choices to list
    super.choices = new Vector<MenuChoice>();
    super.choices.add(addTF);
    super.choices.add(addMultChoice);
    super.choices.add(addEssay);
    super.choices.add(addShortAns);
    super.choices.add(addRanking);
    super.choices.add(addMatching);
    super.choices.add(back);
  }
Ejemplo n.º 25
0
    public NewtMenuBar() {
      fileMenu = new Menu(FILE_MENU_TEXT);
      fileMenu.add(new MenuItem(QUIT_MENUITEM_TEXT));
      add(fileMenu);

      fractalMenu = new Menu(FRACTAL_MENU_TEXT);
      fractalMenu.add(new MenuItem(MANDELBROT_MENUITEM_TEXT));
      fractalMenu.add(new MenuItem(JULIA_MENUITEM_TEXT));
      fractalMenu.add(new MenuItem(NEWTON_MENUITEM_TEXT));
      fractalMenu.add(new MenuItem(AMSJULIA_MENUITEM_TEXT));
      add(fractalMenu);

      settingsMenu = new Menu(SETTINGS_MENU_TEXT);
      settingsMenu.add(new MenuItem(FRACTALGENERATORSETTINGS_MENUITEM_TEXT));
      add(settingsMenu);

      fileMenu.addActionListener(this);
      fractalMenu.addActionListener(this);
      settingsMenu.addActionListener(this);
    }
Ejemplo n.º 26
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   menu.add(0, CONFIG_ID, 0, R.string.config);
   return true;
 }
Ejemplo n.º 27
0
 protected MenuItem addMenuItem(Menu menu, int index, String resourceKey, int iconId) {
   final String label = myResource.getResource("menu").getResource(resourceKey).getValue();
   return menu.add(0, index, Menu.NONE, label).setIcon(iconId);
 }
Ejemplo n.º 28
0
  public dbfShow(String title, String fname) throws Exception {

    super(title);
    String dbname;
    addWindowListener(this);
    sp = new ScrollPane();
    viewPane = new Panel();
    sp.add(viewPane);
    this.add(sp);

    if (fname == null || fname.length() == 0) {
      FileDialog fd = new FileDialog(this, "dbfShow", FileDialog.LOAD);
      fd.setFile("*.DBF");
      fd.pack();
      fd.setVisible(true);
      String DBFname = fd.getFile();
      String dirname = fd.getDirectory();

      if (DBFname == null) {
        System.exit(0);
      }
      if (DBFname.length() < 1) {
        System.exit(0);
      }
      dbname = new String(dirname + DBFname);
    } else {
      dbname = new String(fname);
    }

    MenuBar mb = new MenuBar();
    this.setMenuBar(mb);
    Menu file = new Menu("File");
    opener = new MenuItem("Open..");
    file.add(opener);
    opener.addActionListener(this);
    packer = new MenuItem("Pack");
    packer.addActionListener(this);
    file.add(packer);
    quiter = new MenuItem("Quit");
    file.add(quiter);
    quiter.addActionListener(this);
    mb.add(file);
    Menu record = new Menu("Record");
    firstRecord = new MenuItem("First");
    firstRecord.addActionListener(this);
    record.add(firstRecord);
    nextRecord = new MenuItem("Next");
    nextRecord.addActionListener(this);
    record.add(nextRecord);
    prevRecord = new MenuItem("Prev");
    prevRecord.addActionListener(this);
    record.add(prevRecord);
    lastRecord = new MenuItem("Last");
    lastRecord.addActionListener(this);
    record.add(lastRecord);
    addRecord = new MenuItem("Add");
    addRecord.addActionListener(this);
    record.add(addRecord);
    updateRecord = new MenuItem("Update");
    updateRecord.addActionListener(this);
    record.add(updateRecord);
    clearRecord = new MenuItem("Clear");
    clearRecord.addActionListener(this);
    record.add(clearRecord);
    mb.add(record);
    crl = new Label("Record", Label.RIGHT);
    trl = new Label(" of ", Label.LEFT);
    SBrecpos = new Scrollbar(Scrollbar.HORIZONTAL, 1, 1, 0, 0);
    SBrecpos.addAdjustmentListener(this);
    delCB = new Checkbox("Deleted");
    delCB.addItemListener(this);
    Prev = new Button("<<Prev");
    Prev.addActionListener(this);
    Next = new Button("Next>>");
    Next.addActionListener(this);
    Add = new Button("Add");
    Add.addActionListener(this);
    Update = new Button("Update");
    Update.addActionListener(this);
    Clear = new Button("Clear");
    Clear.addActionListener(this);
    setupDBFields(dbname);
    setTitle(dbname + ",   org.xBaseJ Version:" + org.xBaseJ.DBF.xBaseJVersion);
    pack();
    setVisible(true);
  }
Ejemplo n.º 29
0
  public DaylightTracker2() {
    // This code is automatically generated by Visual Cafe when you add
    // components to the visual environment. It instantiates and initializes
    // the components. To modify the code, only use code syntax that matches
    // what Visual Cafe can generate, or Visual Cafe may be unable to back
    // parse your Java file into its visual environment.
    // {{INIT_CONTROLS
    getContentPane().setLayout(new BorderLayout());
    setSize(560, 300);
    setTitle("Day and Night");
    // }}

    // setResizable(false);

    JPanel theRealBasePanel = new JPanel();
    theRealBasePanel.setLayout(new MultiCompBorderLayout());
    getContentPane().add(theRealBasePanel);

    MenuBar theMenuBar = new MenuBar();
    setMenuBar(theMenuBar);

    theMenuBar.add(fileMenu = new Menu("File"));
    fileMenu.add(file_quitItem = new MenuItem("Quit"));

    theMenuBar.add(editMenu = new Menu("Edit"));
    editMenu.add(edit_undoItem = new MenuItem("Undo"));
    edit_undoItem.setEnabled(false);
    editMenu.add(new MenuItem("-"));
    editMenu.add(edit_cutItem = new MenuItem("Cut"));
    edit_cutItem.setEnabled(false);
    editMenu.add(edit_copyItem = new MenuItem("Copy"));
    edit_copyItem.setEnabled(false);
    editMenu.add(edit_pasteItem = new MenuItem("Paste"));
    edit_pasteItem.setEnabled(false);
    editMenu.add(edit_clearItem = new MenuItem("Clear"));
    edit_clearItem.setEnabled(false);
    editMenu.add(new MenuItem("-"));
    editMenu.add(edit_prefsItem = new MenuItem("Preferences..."));

    theMenuBar.add(layersMenu = new Menu("Layers"));

    theMenuBar.setHelpMenu(helpMenu = new Menu("Help"));
    helpMenu.add(help_aboutItem = new MenuItem("About JSunTool..."));

    allMapLayers.addElement(new OverlayedTimeLayer());
    allMapLayers.addElement(new NightDay());
    allMapLayers.addElement(new GeographicalMap());
    allMapLayers.addElement(new TopographicalMap());

    menuMapLayers = new CheckboxMenuItem[allMapLayers.size()];

    CheckboxMenuActionListener theCheckboxMenuActionListener = new CheckboxMenuActionListener();

    for (int i = 0; i < allMapLayers.size(); i++) {

      visibleMapLayers.addElement(allMapLayers.elementAt(i));
      theRealBasePanel.add((Component) (visibleMapLayers.elementAt(i)));

      // CheckboxMenuItem tempMenuItem
      menuMapLayers[i] =
          new CheckboxMenuItem(((MapLayer) (allMapLayers.elementAt(i))).getShortName(), true);
      menuMapLayers[i].setActionCommand(new String("MapLayer." + i));
      menuMapLayers[i].addItemListener(theCheckboxMenuActionListener);
      layersMenu.add(menuMapLayers[i]);
    }

    // {{INIT_MENUS
    // }}

    // {{REGISTER_LISTENERS
    SymWindow aSymWindow = new SymWindow();
    this.addWindowListener(aSymWindow);
    // }}

    // Timer theTimer = new Timer ( 1800000, new TimerActionListener() );
    //		Timer theTimer = new Timer ( 1000, new TimerActionListener() );
    //		theTimer.start();
    (new Thread(this)).start();

    MenuActionListener theMenuActionListener = new MenuActionListener();
    file_quitItem.addActionListener(theMenuActionListener);
    help_aboutItem.addActionListener(theMenuActionListener);
  }
Ejemplo n.º 30
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    menu.add("menu"); // ���봴��һ��
    return super.onCreateOptionsMenu(menu);
  }