javax.swing.JButton.setVisible()方法的使用及代码示例

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

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

JButton.setVisible介绍

暂无

代码示例

代码示例来源:origin: chewiebug/GCViewer

public void setGCResource(GCResource gcResource) {
  textAreaLogHandler.reset();
  progressBar.setVisible(true);
  progressBar.setValue(0);
  cancelButton.setVisible(true);
  messageLabel.setVisible(false);
  gcResource.getLogger().addHandler(textAreaLogHandler);
  this.gcResource = gcResource;
}

代码示例来源:origin: chewiebug/GCViewer

/**
 * Invoked when task's progress property changes.
 */
@Override
public void propertyChange(PropertyChangeEvent evt) {
  final String eventPropertyName = evt.getPropertyName();
  if ("progress".equals(eventPropertyName)) {
    progressBar.setValue((int)evt.getNewValue());
  }
  else if ("state".equals(eventPropertyName)) {
    if (SwingWorker.StateValue.STARTED == evt.getNewValue()) {
      // don't clear textArea here, because event comes late!
    }
    else if (SwingWorker.StateValue.DONE == evt.getNewValue()) {
      progressBar.setValue(100);
      final int nErrors = textAreaLogHandler.getErrorCount();
      messageLabel.setText(LocalisationHelper.getString("datareader_parseerror_dialog_message", nErrors));
      messageLabel.setVisible(true);
      progressBar.setVisible(false);
      cancelButton.setVisible(false);
    }
  }
}

代码示例来源:origin: 4thline/cling

@PostConstruct
public void init() {
  setFloatable(false);
  setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));
  demoButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      presenter.onCreateDemoDevice();
    }
  });
  add(demoButton);
  enableNetworkButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      presenter.onEnableNetwork();
    }
  });
  enableNetworkButton.setVisible(false);
  add(enableNetworkButton);
  disableNetworkButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      presenter.onDisableNetwork();
    }
  });
  disableNetworkButton.setVisible(true);
  add(disableNetworkButton);
}

代码示例来源:origin: magefree/mage

lblName.setText("Name:");
lbTimeLimit.setText("Time:");
lbTimeLimit.setToolTipText("The time a player has for the whole match. If a player runs out of time during a game, he loses the complete match. ");
lbSkillLevel.setText("Skill:");
lbSkillLevel.setToolTipText("The time a player has for the whole match. If a player runs out of time during a game, he loses the complete match. ");
btnSavedConfiguration1.addActionListener(evt -> btnSavedConfigurationActionPerformed(evt, 1));
btnSavedConfiguration1.setVisible(true);
btnSavedConfiguration2.addActionListener(evt -> btnSavedConfigurationActionPerformed(evt, 2));
btnSavedConfiguration2.setVisible(true);
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));

代码示例来源:origin: RipMeApp/ripme

statusLabel.setHorizontalAlignment(JLabel.CENTER);
openButton = new JButton();
openButton.setVisible(false);
JPanel statusPanel = new JPanel(new GridBagLayout());
statusPanel.setBorder(emptyBorder);
try {
  String workingDir = (Utils.shortenPath(Utils.getWorkingDirectory()));
  configSaveDirLabel.setText(workingDir);
  configSaveDirLabel.setForeground(Color.BLUE);
  configSaveDirLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));

代码示例来源:origin: org.jdtaus.core/jdtaus-core-utilities

state.panel.getProgressDescriptionLabel().setText(
    state.task.getProgressDescription().getText( getLocale() ) );
  state.panel.getProgressDescriptionLabel().setVisible( false );
  state.panel.getProgressBar().setMaximum( state.task.getMaximum() );
  state.panel.getProgressBar().setValue( state.task.getProgress() );
  state.panel.getTimeLabel().setText( getComputingExpectedDurationMessage( getLocale() ) );
  state.panel.getTimeLabel().setText( getIndeterminateDurationMessage( getLocale() ) );
state.panel.getCancelButton().setVisible( state.task.isCancelable() );
state.panel.getCancelButton().addActionListener( state.cancelListener );
state.panel.setVisible( false );
getDialog().add( state.panel );

代码示例来源:origin: magefree/mage

insertArrow.setVisible(false);
cardContent.add(insertArrow, new Integer(1000));
analyseButton.addActionListener(evt -> analyseDeck());
blingButton.addActionListener(evt -> blingDeck());
filterPopup.setPreferredSize(new Dimension(300, 300));
makeButtonPopup(filterButton, filterPopup);
filterButton.setVisible(false);

代码示例来源:origin: RipMeApp/ripme

statusProgress.setValue(0);
statusProgress.setVisible(false);
openButton.setVisible(false);
pack();
statusWithColor("Error: " + msg.getObject(), Color.RED);
statusProgress.setValue(0);
statusProgress.setVisible(false);
openButton.setVisible(true);
File f = rsc.dir;
String prettyFile = Utils.shortenPath(f);
openButton.addActionListener(event -> {
  try {
    Desktop.getDesktop().open(new File(event.getActionCommand()));
statusProgress.setValue(0);
statusProgress.setVisible(false);
openButton.setVisible(false);
pack();
statusWithColor("Error: " + msg.getObject(), Color.RED);

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

jLabel1.setText(
  getResourceConverter().getString(
    "preferences.driverClassName.title", "Driver Class Name"));
jPanel1.add(jLabel1, gridBagConstraints);
jLabel2.setText(
  getResourceConverter().getString(
    "preferences.connectionURL.title", "Connection URL"));
jPanel1.add(jLabel2, gridBagConstraints);
jLabel3.setText(
  getResourceConverter().getString(
    "preferences.userName.title", "User name"));
    "preferences.selectSchemasButton.title",
    "Select Schemas"));
selectSchemasButton.addActionListener(
  new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
selectSchemasButton.setVisible(false);

代码示例来源:origin: magefree/mage

public void showDialog(UserRequestMessage userRequestMessage) {
  this.userRequestMessage = userRequestMessage;
  this.setTitle(userRequestMessage.getTitel());
  String text = "<html><p style=\"text-align:center; margin-left:10px; margin-right:10px\">" + userRequestMessage.getMessage() + "</p></html>";
  this.lblText.setText(text);
  if (userRequestMessage.getButton1Text() != null) {
    this.btn1.setText(userRequestMessage.getButton1Text());
  } else {
    this.btn1.setVisible(false);
  }
  if (userRequestMessage.getButton2Text() != null) {
    this.btn2.setText(userRequestMessage.getButton2Text());
  } else {
    this.btn2.setVisible(false);
  }
  if (userRequestMessage.getButton3Text() != null) {
    this.btn3.setText(userRequestMessage.getButton3Text());
  } else {
    this.btn3.setVisible(false);
  }
  this.pack();
  this.revalidate();
  this.repaint();
  this.setModal(true);
  this.setVisible(true);
}

代码示例来源:origin: magefree/mage

btnSwitchHands.setVisible(handCards.size() > 1);
    boolean change = (handCardsOfOpponentAvailable != (game.getOpponentHands() != null));
    if (change) {
    btnSwitchHands.setVisible(!handCards.isEmpty());
  this.txtPhase.setText(game.getPhase().toString());
} else {
  this.txtPhase.setText("");
  this.txtStep.setText(game.getStep().toString());
} else {
  logger.debug("Step is empty");
  this.txtSpellsCast.setVisible(true);
  this.txtSpellsCast.setText(' ' + Integer.toString(game.getSpellsCastCurrentTurn()) + ' ');
} else {
  this.txtSpellsCast.setVisible(false);

代码示例来源:origin: RipMeApp/ripme

openButton.setVisible(false);
statusLabel.setVisible(true);
pack();
boolean failed = false;

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

label.setVisible(false);
btn.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
    btn.setVisible(false);
    label.setVisible(true);
    frame.pack();

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

clearButton.setBorderPainted(false);
clearButton.setContentAreaFilled(false);
clearButton.setVisible(false);
clearButton.addActionListener(evt -> setText(null));

代码示例来源:origin: jsettlers/settlers-remake

public void setJoinMultiPlayerMap(IJoinPhaseMultiplayerGameConnector joinMultiPlayerMap, MapLoader mapLoader) {
  playerSlotFactory = new ClientOfMultiplayerPlayerSlotFactory();
  titleLabel.setText(Labels.getString("join-game-panel-join-multi-player-game-title"));
  numberOfPlayersComboBox.setEnabled(false);
  peaceTimeComboBox.setEnabled(false);
  startResourcesComboBox.setEnabled(false);
  setChatVisible(true);
  cancelButton.addActionListener(e -> settlersFrame.showMainMenu());
  startGameButton.setVisible(false);
  prepareUiFor(mapLoader);
  joinMultiPlayerMap.getPlayers().setListener(changingPlayers -> onPlayersChanges(changingPlayers, joinMultiPlayerMap));
  joinMultiPlayerMap.setMultiplayerListener(new IMultiplayerListener() {
    @Override
    public void gameIsStarting(IStartingGame game) {
      settlersFrame.showStartingGamePanel(game);
    }
    @Override
    public void gameAborted() {
      settlersFrame.showMainMenu();
    }
  });
  initializeChatFor(joinMultiPlayerMap);
  onPlayersChanges(joinMultiPlayerMap.getPlayers(), joinMultiPlayerMap); // init the UI with the players
}

代码示例来源:origin: magefree/mage

public void init(UUID gameId, UUID playerId, BigCard bigCard, int priorityTime) {
  this.gameId = gameId;
  this.playerId = playerId;
  this.bigCard = bigCard;
  cheat.setVisible(SessionHandler.isTestMode());
  cheat.setFocusable(false);
  flagName = null;
  if (priorityTime > 0) {
    long delay = 1000L;
    timer = new PriorityTimer(priorityTime, delay, () -> {
      // do nothing
    });
    final PriorityTimer pt = timer;
    timer.setTaskOnTick(() -> {
      int priorityTimeValue = pt.getCount();
      String text = getPriorityTimeLeftString(priorityTimeValue);
      PlayerPanelExt.this.avatar.setTopText(text);
      PlayerPanelExt.this.timerLabel.setText(text);
      PlayerPanelExt.this.avatar.repaint();
    });
    timer.init(gameId);
  }
}

代码示例来源:origin: MegaMek/mekhq

@Override
  public void actionPerformed(ActionEvent e) {
    campaign.setRetainerEmployerCode(cbRetainerEmployer.getSelectedItemKey());
    lblCurrentRetainer.setVisible(true);
    lblRetainerEmployer.setVisible(true);
    btnEndRetainer.setVisible(true);
    lblRetainerEmployer.setText(Faction.getFaction(campaign.getRetainerEmployerCode()).getFullName(campaign.getGameYear()));
    //Remove the selected faction and add the previous one, if any
    countSuccessfulContracts();
    lblRetainerAvailable.setVisible(possibleRetainerContracts.size() > 0);
    cbRetainerEmployer.setVisible(possibleRetainerContracts.size() > 0);
    btnStartRetainer.setVisible(possibleRetainerContracts.size() > 0);
  }            
});

代码示例来源:origin: magefree/mage

public void showDeckElements(boolean show) {
  this.lblPlayerDeck.setVisible(show);
  this.txtPlayerDeck.setVisible(show);
  this.btnGenerate.setVisible(show);
  this.btnPlayerDeck.setVisible(show);
}

代码示例来源:origin: magefree/mage

private void customInitComponents() {
  btnRight = new javax.swing.JButton();
  btnLeft = new javax.swing.JButton();
  btnSpecial = new javax.swing.JButton();
  btnUndo = new javax.swing.JButton();
  btnUndo.setVisible(true);
  setBackground(new java.awt.Color(0, 0, 0, 80));
  btnRight.setText("Cancel");
  btnRight.addActionListener(evt -> btnRightActionPerformed(evt));
  btnLeft.setText("OK");
  btnLeft.addActionListener(evt -> btnLeftActionPerformed(evt));
  btnSpecial.setText("Special");
  btnSpecial.addActionListener(evt -> btnSpecialActionPerformed(evt));
  btnUndo.setText("Undo");
  btnUndo.addActionListener(evt -> btnUndoActionPerformed(evt));
}

代码示例来源:origin: jsettlers/settlers-remake

public void setSinglePlayerMap(MapLoader mapLoader) {
  this.playerSlotFactory = new SinglePlayerSlotFactory();
  titleLabel.setText(Labels.getString("join-game-panel-new-single-player-game-title"));
  numberOfPlayersComboBox.setEnabled(true);
  peaceTimeComboBox.setEnabled(true);
  startResourcesComboBox.setEnabled(true);
  startGameButton.setVisible(true);
  setChatVisible(false);
  cancelButton.addActionListener(e -> settlersFrame.showMainMenu());
  setStartButtonActionListener(e -> {
    long randomSeed = System.currentTimeMillis();
    PlayerSetting[] playerSettings = playerSlots.stream()
        .sorted((playerSlot, otherPlayerSlot) -> playerSlot.getSlot() - otherPlayerSlot.getSlot())
        .map(playerSlot -> {
          if (playerSlot.isAvailable()) {
            return new PlayerSetting(playerSlot.getPlayerType(), playerSlot.getCivilisation(),
                playerSlot.getTeam());
          } else {
            return new PlayerSetting();
          }
        })
        .toArray(PlayerSetting[]::new);
    JSettlersGame game = new JSettlersGame(mapLoader, randomSeed, playerSlots.get(0).getSlot(), playerSettings);
    IStartingGame startingGame = game.start();
    settlersFrame.showStartingGamePanel(startingGame);
  });
  setCancelButtonActionListener(e -> settlersFrame.showMainMenu());
  prepareUiFor(mapLoader);
}

相关文章

JButton类方法