java.awt.Menu.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中java.awt.Menu.<init>()方法的一些代码示例,展示了Menu.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Menu.<init>()方法的具体详情如下:
包路径:java.awt.Menu
类名称:Menu
方法名:<init>

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

private MenuBar createMenuBar() {
  MenuBar ret=new MenuBar();
  Menu file=new Menu("File");
  MenuItem quitm=new MenuItem("Quit");
  ret.setFont(def_font2);
  ret.add(file);
  file.addSeparator();
  file.add(quitm);
  quitm.addActionListener(e -> System.exit(1));
  return ret;
}

代码示例来源:origin: stackoverflow.com

menuBar.getMenus().addAll(new Menu("School"), new Menu("Social"), new Menu("Network"));
TreeItem<String> root = new TreeItem<>("Private Notes");
root.setExpanded(false);

代码示例来源:origin: stackoverflow.com

Menu fileMenu = new Menu("_File");
MenuItem exitMenuItem = new MenuItem("E_xit");
exitMenuItem.setGraphic(new ImageView(new Image(CLOSE_ICON)));
Menu zoomMenu = new Menu("_Zoom");
MenuItem zoomResetMenuItem = new MenuItem("Zoom _Reset");
zoomResetMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.ESCAPE));

代码示例来源:origin: stackoverflow.com

Menu fileMenu = new Menu("_File");
MenuItem exitMenuItem = new MenuItem("E_xit");
exitMenuItem.setGraphic(new ImageView(new Image(CLOSE_ICON)));
  exitMenuItem
);
Menu zoomMenu = new Menu("_Zoom");
MenuItem zoomResetMenuItem = new MenuItem("Zoom _Reset");
zoomResetMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.ESCAPE));

代码示例来源:origin: stackoverflow.com

Label menuLabel = new Label("File");
 // menuLabel.setStyle("-fx-background-color: yellow; -fx-padding: 0px;");
 menuLabel.setOnMouseClicked(new EventHandler<MouseEvent>() {
   @Override
   public void handle(MouseEvent event) {
     System.out.println("File menu clicked");
     Stage myDialog = new Stage();
      myDialog.initModality(Modality.WINDOW_MODAL);
      Scene myDialogScene = new Scene(VBoxBuilder.create()
          .children(new Text("Hello! it's My Dialog."))
          .alignment(Pos.CENTER)
          .padding(new Insets(10))
          .build());
      myDialog.setScene(myDialogScene);
      myDialog.show();
   }
 });
 Menu fileMenuButton = new Menu();
 fileMenuButton.setGraphic(menuLabel);
 menuBar.getMenus().add(fileMenuButton);

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage stage) {
  Menu fileMenu = new Menu("_File");
  MenuItem newFileMenuItem = new MenuItem("_New...");
  newFileMenuItem.setAccelerator(

代码示例来源:origin: stackoverflow.com

switch(...) {
  case 2: 
    frag = new Menu();
    // get the value of the spinner selected from here! Something like this:
     String text = ((Spinner) findViewById(R.id.spinnerSetting)). getSelectedItem().toString();
    // String named "spinner_position", this is how you can get it after
    args.putString("spinner_position", text);
    break;
  ...
}
frag.setArguments(args);
// replace the fragment

代码示例来源:origin: stackoverflow.com

if (user.equals("Stacy") && pwd.equals("password"))
      new Menu().setVisible(true);
else
 JOptionPane.showMessageDialog(frame,
    "Incorrect Username or Password",
    ,"Error While Login"
    JOptionPane.WARNING_MESSAGE);

代码示例来源:origin: stackoverflow.com

public class Main {
  public static void main(String[] args){
    new ExampleFrame(new Menu());
  }
}

代码示例来源:origin: IanDarwin/javasrc

/** Convenience routine to make a Menu */
public Menu mkMenu(ResourceBundle b, String name) {
  String menuLabel;
  try { menuLabel = b.getString(name+".label"); }
  catch (MissingResourceException e) { menuLabel=name; }
  return new Menu(menuLabel);
}

代码示例来源:origin: stackoverflow.com

SceneObject[] scenes = { new Loading(), new Menu() };

...

for (SceneObject scene : scenes) {
  scene.foo();
  scene.bar();
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      new Menu();
    }
  });
}

代码示例来源:origin: stackoverflow.com

CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
Menu displayMenu = new Menu("Display");
MenuItem errorItem = new MenuItem("Error");
MenuItem warningItem = new MenuItem("Warning");

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {
 SwingUtilities.invokeLater(new Runnable() {
   public void run() {
     Menu app = new Menu();
     app.setVisible(true);
   }
 });

代码示例来源:origin: stackoverflow.com

Menu m = new Menu();

switch (choice) {
  case 0:
    m.FileMenu();
    break;

  case 1:
    m.ViewMenu();
    break;

  }

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage primaryStage) {
  SplitPane splitPane = new SplitPane(new TableView(),
                    new VBox(new Label("some other content")));

  splitPane.setOrientation(Orientation.HORIZONTAL);

  // place splitPane as center
  BorderPane borderPane = new BorderPane(splitPane);

  borderPane.setTop(new MenuBar(new Menu("File")));

  Scene scene = new Scene(borderPane, 600, 400);

  primaryStage.setScene(scene);
  primaryStage.show();
}

代码示例来源:origin: stackoverflow.com

public class Main {

  public static void main(String[] args) {

    Menu newMenu = new Menu();

    boolean continuePlaying = newMenu.menu();

    while (continuePlaying) {
      continuePlaying = newMenu.menu();
    }
  }

}

代码示例来源:origin: org.scijava/scijava-ui-awt

protected Menu createNonLeaf(final ShadowMenu shadow) {
  final Menu menu = new Menu(shadow.getMenuEntry().getName());
  assignProperties(menu, shadow);
  return menu;
}

代码示例来源:origin: stackoverflow.com

Menu menu = new Menu("Radio Button Menu");

ToggleGroup myToggleGroup = new ToggleGroup();

RadioMenuItem itemOne = RadioMenuItemBuilder.create().toggleGroup(myToggleGroup).text("itemOne").build();
RadioMenuItem itemTwo = RadioMenuItemBuilder.create().toggleGroup(myToggleGroup).text("itemTwo").selected(true).build();

menu.getItems().add(itemOne);
menu.getItems().add(itemTwo);

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private MenuBar createMenuBar() {
  MenuBar ret=new MenuBar();
  Menu file=new Menu("File");
  MenuItem quitm=new MenuItem("Quit");
  ret.setFont(def_font2);
  ret.add(file);
  file.addSeparator();
  file.add(quitm);
  quitm.addActionListener(e -> System.exit(1));
  return ret;
}

相关文章