javax.swing.JMenuItem.getText()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(115)

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

JMenuItem.getText介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void actionPerformed(ActionEvent e) {
    if (itemRemoveCanvas.getText().equals("Remove Canvas")){
      currentPanel.remove(canvas);
      itemRemoveCanvas.setText("Add Canvas");
    }else if (itemRemoveCanvas.getText().equals("Add Canvas")){
      currentPanel.add(canvas, BorderLayout.CENTER);
      itemRemoveCanvas.setText("Remove Canvas");
    }
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void actionPerformed(ActionEvent e){
    if (itemSwitchTab.getText().equals("Switch to tab #2")){
      canvasPanel1.remove(canvas);
      canvasPanel2.add(canvas, BorderLayout.CENTER);
      currentPanel = canvasPanel2;
      itemSwitchTab.setText("Switch to tab #1");
    }else if (itemSwitchTab.getText().equals("Switch to tab #1")){
      canvasPanel2.remove(canvas);
      canvasPanel1.add(canvas, BorderLayout.CENTER);
      currentPanel = canvasPanel1;
      itemSwitchTab.setText("Switch to tab #2");
    }
  }
});

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void actionPerformed(ActionEvent e) {
    if (itemHideCanvas.getText().equals("Hide Canvas")){
      canvas.setVisible(false);
      itemHideCanvas.setText("Show Canvas");
    }else if (itemHideCanvas.getText().equals("Show Canvas")){
      canvas.setVisible(true);
      itemHideCanvas.setText("Hide Canvas");
    }
  }
});

代码示例来源:origin: pentaho/mondrian

private JInternalFrame lookupFrame(String sfname) {
  JInternalFrame sf = null;
  for (Map.Entry<JInternalFrame, JMenuItem> entry
    : schemaWindowMap.entrySet())
  {
    if ((entry.getValue()).getText().equals(sfname)) {
      sf = entry.getKey();
      break;
    }
  }
  return sf;
}

代码示例来源:origin: pentaho/mondrian

private void setCatalogs() {
  List<String> v = new ArrayList<String>();
  Iterator<JMenuItem> it = schemaWindowMap.values().iterator();
  while (it.hasNext()) {
    JMenuItem elem = it.next();
    v.add(elem.getText());
  }
  ComboBoxModel cCatalogs =
    new DefaultComboBoxModel(new Vector<String>(v));
  schemaList.setModel(cCatalogs);
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void actionPerformed(ActionEvent e) {
  JMenuItem item = (JMenuItem) e.getSource();
  MenuBarCoder.this.menu.setText(item.getText());
  MenuBarCoder.this.menu.requestFocus();
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void actionPerformed(ActionEvent arg0) {
  this.transform(this.coderManager.getMenuMethod().getText());
}

代码示例来源:origin: ron190/jsql-injection

public void actionPerformed() {
  this.transform(this.coderManager.getMenuMethod().getText());
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.TIME.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.BLIND.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.BLIND.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(false);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.TIME.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(false);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.NORMAL.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.NORMAL.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setEnabled(false);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  // Fix #36975: ArrayIndexOutOfBoundsException on getItem()
  // Fix #40352: NullPointerException on ?
  try {
    for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
      if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.ERROR.toString())) {
        ((JMenu) MediatorGui.managerDatabase().getMenuStrategy().getItem(i)).getItem(this.indexMethodError).setEnabled(false);
        break;
      }
    }
  } catch (ArrayIndexOutOfBoundsException | NullPointerException e) {
    LOGGER.error(e, e);
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    JMenuItem menuItemStrategy = MediatorGui.managerDatabase().getMenuStrategy().getItem(i);
    if (menuItemStrategy.getText().equals(StrategyInjection.ERROR.toString())) {
      JMenu menuError = (JMenu) menuItemStrategy;
      menuError.setEnabled(true);
      
      // Fix #46578: ArrayIndexOutOfBoundsException on getItem()
      if (0 <= this.indexMethodError && this.indexMethodError < menuError.getItemCount()) {
        menuError.getItem(this.indexMethodError).setEnabled(true);
      }
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  MediatorGui.managerDatabase().getMenuStrategy().setText(StrategyInjection.NORMAL.toString());
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.NORMAL.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setSelected(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  MediatorGui.managerDatabase().getMenuStrategy().setText(StrategyInjection.BLIND.toString());
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.BLIND.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setSelected(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  MediatorGui.managerDatabase().getMenuStrategy().setText(StrategyInjection.TIME.toString());
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    if (MediatorGui.managerDatabase().getMenuStrategy().getItem(i).getText().equals(StrategyInjection.TIME.toString())) {
      MediatorGui.managerDatabase().getMenuStrategy().getItem(i).setSelected(true);
      break;
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void execute() {
  if (MediatorGui.managerDatabase() == null) {
    LOGGER.error("Unexpected unregistered MediatorGui.managerDatabase() in "+ this.getClass());
  }
  
  MediatorGui.managerDatabase().getMenuStrategy().setText(StrategyInjection.ERROR.toString());
  
  JMenu menuError = (JMenu) MediatorGui.managerDatabase().getMenuStrategy().getMenuComponent(2);
  int indexError = StrategyInjection.ERROR.instance().getIndexMethod();
  String nameError = MediatorModel.model().getVendor().instance().getXmlModel().getStrategy().getError().getMethod().get(indexError).getName();
  
  for (int i = 0 ; i < MediatorGui.managerDatabase().getMenuStrategy().getItemCount() ; i++) {
    // Fix #44635: ArrayIndexOutOfBoundsException on getItem()
    try {
      if (menuError.getItem(i).getText().equals(nameError)) {
        menuError.getItem(i).setSelected(true);
        MediatorGui.managerDatabase().getMenuStrategy().setText(nameError);
        break;
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      LOGGER.error(e, e);
    }
  }
}

相关文章

JMenuItem类方法