javax.swing.JLabel#setVisible ( )源码实例Demo

下面列出了javax.swing.JLabel#setVisible ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Spark   文件: IconTextField.java
/**
 * Creates a new IconTextField with Icon.
 *
 * @param icon the icon.
 */
public IconTextField(Icon icon) {
    setLayout(new GridBagLayout());
    setBackground((Color)UIManager.get("TextField.background"));

    textField = new JTextField();
    textField.setBorder(null);
    setBorder(new JTextField().getBorder());

    imageComponent = new JLabel(icon);
    downOption = new JLabel(SparkRes.getImageIcon(SparkRes.DOWN_OPTION_IMAGE));

    add(downOption, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    add(imageComponent, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    add(textField, new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0), 0, 0));

    downOption.setVisible(false);
}
 
源代码2 项目: collect-earth   文件: PropertiesDialog.java
public void handleVisibilityPlotLayout(JComboBox plotShape, JComboBox numberPoints, JComboBox distanceBetweenPoints,
		JComboBox distanceToFrame, JComboBox dotsSide, JComboBox distanceBetweenPlots, JLabel area,
		JLabel distanceOrRadiuslabel, JComboBox largeCentralPlotSide ) {
	numberPoints.setEnabled(false);
	distanceBetweenPoints.setEnabled(false);
	distanceToFrame.setEnabled(false);
	dotsSide.setEnabled(false);
	area.setVisible(false);
	distanceBetweenPlots.setVisible(false);
	distanceBetweenPlots.setEnabled(false);
	largeCentralPlotSide.setVisible( false );
	largeCentralPlotSide.setEnabled(false);

	if (plotShape.getSelectedItem().equals(SAMPLE_SHAPE.SQUARE) || plotShape.getSelectedItem().equals(SAMPLE_SHAPE.SQUARE_WITH_LARGE_CENTRAL_PLOT) ) {
		numberPoints.setEnabled(true);
		distanceBetweenPoints.setEnabled(true);
		distanceToFrame.setEnabled(true);
		dotsSide.setEnabled(true);
		area.setVisible(true);
		distanceOrRadiuslabel.setText(Messages.getString("OptionWizard.36"));

		if( plotShape.getSelectedItem().equals(SAMPLE_SHAPE.SQUARE_WITH_LARGE_CENTRAL_PLOT) ) {
			largeCentralPlotSide.setVisible( true );
			largeCentralPlotSide.setEnabled(true);
		}

	} else if (plotShape.getSelectedItem().equals(SAMPLE_SHAPE.CIRCLE)
			|| plotShape.getSelectedItem().equals(SAMPLE_SHAPE.HEXAGON)) {
		distanceBetweenPoints.setEnabled(true);
		dotsSide.setEnabled(true);
		numberPoints.setEnabled(true);
		distanceOrRadiuslabel.setText("Radius");
	} else if (plotShape.getSelectedItem().equals(SAMPLE_SHAPE.NFI_THREE_CIRCLES) || plotShape.getSelectedItem().equals(SAMPLE_SHAPE.NFI_FOUR_CIRCLES)) {
		dotsSide.setEnabled(true);
		distanceBetweenPoints.setEnabled(true);
		distanceBetweenPlots.setVisible(true);
		distanceBetweenPlots.setEnabled(true);
		distanceOrRadiuslabel.setText("Radius of the plots");
	}
}
 
源代码3 项目: stendhal   文件: StatusIconPanel.java
/**
 * Hide all status icons. This is called when the user entity is deleted.
 */
void resetStatuses() {
	for (JLabel status : statusIDMap.values()) {
		if (status.isVisible()) {
			status.setVisible(false);
		}
	}
}
 
源代码4 项目: netbeans   文件: BoxFillerInitializer.java
WidthHeightPanel(boolean showWidth, boolean showHeight) {
    ResourceBundle bundle = NbBundle.getBundle(BoxFillerInitializer.class);
    JLabel widthLabel = new JLabel(bundle.getString("BoxFillerInitializer.width")); // NOI18N
    JLabel heightLabel = new JLabel(bundle.getString("BoxFillerInitializer.height")); // NOI18N
    widthField = new JSpinner(new SpinnerNumberModel());
    heightField = new JSpinner(new SpinnerNumberModel());
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                .addComponent(widthLabel)
                .addComponent(heightLabel))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(widthField)
                .addComponent(heightField))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(widthLabel)
                .addComponent(widthField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(heightLabel)
                .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );
    widthLabel.setVisible(showWidth);
    heightLabel.setVisible(showHeight);
    widthField.setVisible(showWidth);
    heightField.setVisible(showHeight);
}
 
源代码5 项目: stendhal   文件: StatusIconPanel.java
protected StatusIconPanel() {
	setLayout(new SBoxLayout(SBoxLayout.HORIZONTAL));
	setOpaque(false);

	eating = new JLabel(eatingIcon);
	add(eating);
	eating.setVisible(false);

	choking = new JLabel(chokingIcon);
	add(choking);
	choking.setVisible(false);

	away = new AnimatedIcon(awaySprite, 2000);
	add(away);
	away.setVisible(false);

	grumpy = new AnimatedIcon(grumpySprite, 2000);
	add(grumpy);
	grumpy.setVisible(false);

	/** Initialize map */
       statusIDMap = new EnumMap<StatusID, JLabel>(StatusID.class);
       statusIDMap.put(StatusID.CONFUSE, createStatusIndicator("confuse"));
       statusIDMap.put(StatusID.POISON, createStatusIndicator("poison"));
       statusIDMap.put(StatusID.SHOCK, createStatusIndicator("shock"));
       statusIDMap.put(StatusID.ZOMBIE, createStatusIndicator("zombie"));
       statusIDMap.put(StatusID.HEAVY, createStatusIndicator("heavy"));
}
 
源代码6 项目: pumpernickel   文件: QOptionPaneUI.java
protected void updateIcon(QOptionPane pane) {
	Icon icon = pane.getIcon();
	JLabel label = getIconLabel(pane);
	if (icon == null) {
		label.setIcon(null);
		label.setVisible(false);
	} else {
		label.setIcon(icon);
		label.setVisible(true);
	}
}
 
源代码7 项目: netbeans   文件: NewProjectConfigurationPanel.java
void visibleApp(boolean visible, JLabel paramsLabel, JTextField paramsTextField, JTextField nameTextField) {
    paramsLabel.setVisible(visible);
    paramsTextField.setVisible(visible);
    if (nameTextField != null) {
        nameTextField.setVisible(visible);
    }
}
 
private void setStars() {
    int locationPoint = 390;
    for (int i = 0; i < 5; i++) {
        stars = new JLabel("");
        stars.setHorizontalTextPosition(SwingConstants.CENTER);
        stars.setHorizontalAlignment(SwingConstants.CENTER);
        stars.setIcon(new ImageIcon(HotelPropertiesWindow.class.getResource("/com/coder/hms/icons/hotel_external_star.png")));
        stars.setBounds(locationPoint, 19, 46, 37);
        stars.setVisible(false);
        starHolder.add(stars);

        starlabels[i] = stars;
        locationPoint = locationPoint + 44;
    }
}
 
源代码9 项目: mzmine3   文件: SizeSelectDialog.java
/**
 * Create the dialog.
 */
public SizeSelectDialog() {
  setBounds(100, 100, 198, 161);
  getContentPane().setLayout(new BorderLayout());
  contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  getContentPane().add(contentPanel, BorderLayout.CENTER);
  contentPanel.setLayout(new MigLayout("", "[][]", "[][][]"));
  {
    JLabel lblWidth = new JLabel("width");
    contentPanel.add(lblWidth, "cell 0 0,alignx trailing");
  }
  {
    txtWidth = new JTextField();
    txtWidth.setText("400");
    contentPanel.add(txtWidth, "cell 1 0,growx");
    txtWidth.setColumns(10);
  }
  {
    JLabel lblHeight = new JLabel("height");
    contentPanel.add(lblHeight, "cell 0 1,alignx trailing");
  }
  {
    txtHeight = new JTextField();
    txtHeight.setText("300");
    contentPanel.add(txtHeight, "cell 1 1,growx");
    txtHeight.setColumns(10);
  }
  {
    lblWrongInput = new JLabel("wrong input");
    lblWrongInput.setFont(new Font("Tahoma", Font.BOLD, 13));
    lblWrongInput.setForeground(new Color(220, 20, 60));
    lblWrongInput.setVisible(false);
    contentPanel.add(lblWrongInput, "cell 0 2 2 1");
  }
  {
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
      JButton okButton = new JButton("OK");
      okButton.addActionListener(e -> checkResultsAndFinish());
      buttonPane.add(okButton);
      getRootPane().setDefaultButton(okButton);
    }
    {
      JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(e -> setVisible(false));
      buttonPane.add(cancelButton);
    }
  }
  setModalityType(ModalityType.APPLICATION_MODAL);
  setVisible(true);
  pack();
}
 
源代码10 项目: SikuliX1   文件: TransitionDialog.java
void init(String text){

      setBackground(Color.yellow);
      setForeground(Color.black);

      JPanel content = new JPanel();
      content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
      add(content);

      textPane = new TextPane();
      textPane.setText(text);
      textPane.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));

      Color darkyellow = new Color(238,185,57);

      titleBar = new JLabel();
      titleBar.setFont(new Font("sansserif", Font.BOLD, 14));
      titleBar.setBackground(darkyellow);
      titleBar.setOpaque(true);
      titleBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
      titleBar.setSize(titleBar.getPreferredSize());
      titleBar.setVisible(false);

      buttons = new Box(BoxLayout.X_AXIS);
      defaultButton = new Button("Close");
      buttons.add(defaultButton);
      buttons.setBorder(BorderFactory.createEmptyBorder(15,5,5,5));

      content.add(titleBar);
      content.add(textPane);
      content.add(buttons);

      // this allows the title bar to take the whole width of the dialog box
      titleBar.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      buttons.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      textPane.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));

      // these allow all the parts to left aligned
      titleBar.setAlignmentX(Component.LEFT_ALIGNMENT);
      textPane.setAlignmentX(Component.LEFT_ALIGNMENT);
      buttons.setAlignmentX(Component.LEFT_ALIGNMENT);

      // these are meant to prevent the message box from stealing
      // focus when it's clicked, but they don't seem to work
//      setFocusableWindowState(false);
//      setFocusable(false);

      // this allows the window to be dragged to another location on the screen
      ComponentMover cm = new ComponentMover();
      cm.registerComponent(this);

      pack();
   }
 
源代码11 项目: FancyBing   文件: StatusBar.java
public StatusBar()
{
    super(new BorderLayout());
    JPanel outerPanel = new JPanel(new BorderLayout());
    add(outerPanel, BorderLayout.CENTER);
    if (Platform.isMac())
    {
        // add some empty space so that status bar does not overlap the
        // window resize widget on Mac OS X
        Dimension dimension = new Dimension(20, 1);
        Box.Filler filler =
            new Box.Filler(dimension, dimension, dimension);
        outerPanel.add(filler, BorderLayout.EAST);
    }
    JPanel panel = new JPanel(new BorderLayout());
    //panel.setBorder(BorderFactory.createLineBorder(Color.gray));
    outerPanel.add(panel, BorderLayout.CENTER);
    m_iconBox = Box.createHorizontalBox();
    panel.add(m_iconBox, BorderLayout.WEST);
    m_toPlayLabel = new JLabel();
    m_toPlayLabel.setMaximumSize(new Dimension(Short.MAX_VALUE,
                                               Short.MAX_VALUE));
    setToPlay(BLACK);
    m_iconBox.add(m_toPlayLabel);

    m_labelSetup
        = new JLabel(GuiUtil.getIcon("gogui-setup-16x16",
                                     i18n("LB_STATUS_SETUP")));
    m_labelSetup.setVisible(false);
    m_labelSetup.setToolTipText(i18n("TT_STATUS_SETUP"));
    m_iconBox.add(m_labelSetup);

    m_iconBox.add(GuiUtil.createSmallFiller());

    m_text = new JLabel() {
            /** Use tool tip if text is truncated. */
            protected void paintComponent(Graphics g)
            {
                super.paintComponent(g);
                String text = super.getText();
                if (text == null
                    || g.getFontMetrics().stringWidth(text) < getWidth())
                    setToolTipText(null);
                else
                    setToolTipText(text);
            }
        };
    setPreferredLabelSize(m_text, 10);
    panel.add(m_text, BorderLayout.CENTER);
    Box moveTextBox = Box.createHorizontalBox();
    panel.add(moveTextBox, BorderLayout.EAST);
    m_moveText = new JLabel();
    setPreferredLabelSize(m_moveText, 12);
    m_moveText.setHorizontalAlignment(SwingConstants.LEFT);
    m_moveTextSeparator = new JSeparator(SwingConstants.VERTICAL);
    moveTextBox.add(m_moveTextSeparator);
    moveTextBox.add(GuiUtil.createSmallFiller());
    moveTextBox.add(m_moveText);
}
 
源代码12 项目: netbeans   文件: StringEditor.java
@Override
public Component getCustomEditor () {
    if (customEditor == null) {
        JTextArea textArea = new JTextArea();
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setColumns(60);
        textArea.setRows(8);
        textArea.getDocument().addDocumentListener(this);
        textArea.getAccessibleContext().setAccessibleName(
                NbBundle.getBundle(StringEditor.class).getString("ACSN_StringEditorTextArea")); //NOI18N
        textArea.getAccessibleContext().setAccessibleDescription(
                NbBundle.getBundle(StringEditor.class).getString("ACSD_StringEditorTextArea")); //NOI18N

        JScrollPane scroll = new JScrollPane();
        scroll.setViewportView(textArea);

        JLabel htmlTipLabel = new JLabel(NbBundle.getMessage(StringEditor.class, "StringEditor.htmlTipLabel.text")); // NOI18N

        JPanel panel = new JPanel();
        GroupLayout layout = new GroupLayout(panel);
        layout.setAutoCreateGaps(true);
        panel.setLayout(layout);
        layout.setHorizontalGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup()
                    .addComponent(scroll)
                    .addComponent(htmlTipLabel))
                .addContainerGap());
        layout.setVerticalGroup(layout.createSequentialGroup()
                .addContainerGap().addComponent(scroll).addComponent(htmlTipLabel));

        customEditor = panel;
        textComp = textArea;
        htmlTipLabel.setVisible(htmlText);
    }

    textComp.setEditable(editable);
    setValueToCustomEditor();

    return customEditor;
}
 
源代码13 项目: VanetSim   文件: EditTrafficModelControlPanel.java
/**
 * Constructor, creating GUI items.
 */
public EditTrafficModelControlPanel() {
	setLayout(new GridBagLayout());
	
	// global layout settings
	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.anchor = GridBagConstraints.PAGE_START;
	c.weightx = 0.5;
	c.gridx = 0;
	c.gridy = 0;
	c.gridheight = 1;
	
	c.gridwidth = 1;

	c.insets = new Insets(5,5,5,5);
	
	c.gridx = 0;
	
	// Radio buttons to select add, edit or delete mode
	ButtonGroup group = new ButtonGroup();
	selectModel_ = new JRadioButton(Messages.getString("EditTrafficControlPanel.model")); //$NON-NLS-1$
	selectModel_.setActionCommand("model"); //$NON-NLS-1$
	selectModel_.addActionListener(this);
	selectModel_.setSelected(true);
	group.add(selectModel_);
	++c.gridy;
	add(selectModel_,c);
			
	selectTraces_ = new JRadioButton(Messages.getString("EditTrafficControlPanel.traces")); //$NON-NLS-1$
	selectTraces_.setActionCommand("traces"); //$NON-NLS-1$
	selectTraces_.addActionListener(this);
	group.add(selectTraces_);
	++c.gridy;
	add(selectTraces_,c);
		
	
	c.gridx = 0;
	chooseTrafficModelLabel_ = new JLabel(Messages.getString("EditTrafficControlPanel.comboBoxModel")); //$NON-NLS-1$
	++c.gridy;
	add(chooseTrafficModelLabel_,c);
	chooseTrafficModel_ = new JComboBox<String>();
	chooseTrafficModel_.setActionCommand("chooseTrafficModel");
	chooseTrafficModel_.addItem("VANETSim classic");
	chooseTrafficModel_.addItem("IDM/MOBIL");
	chooseTrafficModel_.addActionListener(this);
	c.gridx = 1;
	add(chooseTrafficModel_, c);
	
	
	c.gridx = 0;
	chooseTracesLabel_ = new JLabel(Messages.getString("EditTrafficControlPanel.comboBoxTraces")); //$NON-NLS-1$
	++c.gridy;
	add(chooseTracesLabel_,c);
	chooseTraces_ = new JComboBox<String>();
	chooseTraces_.setActionCommand("chooseTraces");
	chooseTraces_.addItem("sjtu taxi traces");
	chooseTraces_.addItem("San Francisco traces");
	chooseTraces_.addActionListener(this);
	c.gridx = 1;
	add(chooseTraces_, c);
	chooseTraces_.setVisible(false);
	chooseTracesLabel_.setVisible(false);
	
	
	
	//to consume the rest of the space
	c.weighty = 1.0;
	++c.gridy;
	JPanel space = new JPanel();
	space.setOpaque(false);
	add(space, c);
}
 
源代码14 项目: jeveassets   文件: GeneralSettingsPanel.java
public GeneralSettingsPanel(final Program program, final SettingsDialog optionsDialog) {
	super(program, optionsDialog, DialoguesSettings.get().general(),  Images.DIALOG_SETTINGS.getIcon());

	jEnterFilters = new JCheckBox(DialoguesSettings.get().enterFilter());

	jHighlightSelectedRow = new JCheckBox(DialoguesSettings.get().highlightSelectedRow());

	jFocusEveOnline = new JCheckBox(DialoguesSettings.get().focusEveOnline());

	JLabel jFocusEveOnlineLinuxHelp = new JLabel(DialoguesSettings.get().focusEveOnlineLinuxHelp());
	jFocusEveOnlineLinuxHelp.setVisible(Platform.isLinux());
	JTextField jFocusEveOnlineLinuxCmd = new JTextField(DialoguesSettings.get().focusEveOnlineLinuxCmd());
	jFocusEveOnlineLinuxCmd.addFocusListener(new FocusAdapter() {
		@Override
		public void focusGained(FocusEvent e) {
			jFocusEveOnlineLinuxCmd.selectAll();
		}
	});
	jFocusEveOnlineLinuxCmd.setEditable(false);
	jFocusEveOnlineLinuxCmd.setVisible(Platform.isLinux());

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addComponent(jEnterFilters)
			.addComponent(jHighlightSelectedRow)
			.addComponent(jFocusEveOnline)
			.addGroup(layout.createSequentialGroup()
				.addGap(30)
				.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
					.addComponent(jFocusEveOnlineLinuxHelp)
					.addComponent(jFocusEveOnlineLinuxCmd)
				)
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(jEnterFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jHighlightSelectedRow, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnline, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnlineLinuxHelp, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnlineLinuxCmd, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
	);
}
 
源代码15 项目: txtUML   文件: GUI.java
protected void changeImage(JLabel to) {
	currentImage.setVisible(false);
	to.setVisible(true);
	currentImage = to;
}
 
源代码16 项目: mzmine2   文件: SizeSelectDialog.java
/**
 * Create the dialog.
 */
public SizeSelectDialog() {
  setBounds(100, 100, 198, 161);
  getContentPane().setLayout(new BorderLayout());
  contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  getContentPane().add(contentPanel, BorderLayout.CENTER);
  contentPanel.setLayout(new MigLayout("", "[][]", "[][][]"));
  {
    JLabel lblWidth = new JLabel("width");
    contentPanel.add(lblWidth, "cell 0 0,alignx trailing");
  }
  {
    txtWidth = new JTextField();
    txtWidth.setText("400");
    contentPanel.add(txtWidth, "cell 1 0,growx");
    txtWidth.setColumns(10);
  }
  {
    JLabel lblHeight = new JLabel("height");
    contentPanel.add(lblHeight, "cell 0 1,alignx trailing");
  }
  {
    txtHeight = new JTextField();
    txtHeight.setText("300");
    contentPanel.add(txtHeight, "cell 1 1,growx");
    txtHeight.setColumns(10);
  }
  {
    lblWrongInput = new JLabel("wrong input");
    lblWrongInput.setFont(new Font("Tahoma", Font.BOLD, 13));
    lblWrongInput.setForeground(new Color(220, 20, 60));
    lblWrongInput.setVisible(false);
    contentPanel.add(lblWrongInput, "cell 0 2 2 1");
  }
  {
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
      JButton okButton = new JButton("OK");
      okButton.addActionListener(e -> checkResultsAndFinish());
      buttonPane.add(okButton);
      getRootPane().setDefaultButton(okButton);
    }
    {
      JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(e -> setVisible(false));
      buttonPane.add(cancelButton);
    }
  }
  setModalityType(ModalityType.APPLICATION_MODAL);
  setVisible(true);
  pack();
}
 
源代码17 项目: netbeans   文件: WizardStepProgressSupport.java
private JComponent createProgressComponent() {
    progressLabel = new JLabel(getDisplayName());

    progressBar = super.getProgressComponent();

    stopButton = new JButton(NbBundle.getMessage(WizardStepProgressSupport.class, "BK2022")); // NOI18N
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    });

    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);

    progressLine = new JPanel();
    progressLine.add(progressBar);
    progressLine.add(Box.createHorizontalStrut(
                            LayoutStyle.getInstance()
                            .getPreferredGap(progressBar,
                                             stopButton,
                                             RELATED,
                                             SwingConstants.EAST,
                                             progressLine)));
    progressLine.add(stopButton);

    progressLine.setLayout(new BoxLayout(progressLine, BoxLayout.X_AXIS));
    progressBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    stopButton.setAlignmentX(JComponent.CENTER_ALIGNMENT);

    layout.setHorizontalGroup(
            layout.createParallelGroup(LEADING)
            .addComponent(progressLabel)
            .addComponent(progressLine));
    layout.setVerticalGroup(
            layout.createSequentialGroup()
            .addComponent(progressLabel)
            .addPreferredGap(RELATED)
            .addComponent(progressLine));
    panel.setLayout(layout);

    layout.setHonorsVisibility(false);   //hiding should not affect prefsize

    progressLabel.setVisible(false);
    progressLine.setVisible(false);

    return panel;
}
 
源代码18 项目: gate-core   文件: ProgressPanel.java
public ProgressPanel() {
  super();

  setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  
  int width = 400;

  progressTotal = new SafeJProgressBar();
  progressTotal.setAlignmentX(CENTER_ALIGNMENT);
  progressTotal.setMaximumSize(
      new Dimension(width, progressTotal.getPreferredSize().height));
  progressTotal.setIndeterminate(true);

  message = new JLabel("");
  message.setIcon(new ProgressIcon(48, 48));
  message.setHorizontalTextPosition(SwingConstants.RIGHT);
  message.setHorizontalAlignment(SwingConstants.CENTER);
  message.setAlignmentX(CENTER_ALIGNMENT);

  dlMsg = new JLabel("Downloading CREOLE Plugin...");
  dlMsg.setIcon(new DownloadIcon(48, 48));
  dlMsg.setHorizontalTextPosition(SwingConstants.RIGHT);
  dlMsg.setHorizontalAlignment(SwingConstants.CENTER);
  dlMsg.setAlignmentX(CENTER_ALIGNMENT);
  dlMsg.setVisible(false);

  partProgress = new JPanel();
  partProgress.setLayout(new BoxLayout(partProgress, BoxLayout.Y_AXIS));

  scroller = new JScrollPane(partProgress);
  scroller.setAlignmentX(CENTER_ALIGNMENT);
  scroller.setMaximumSize(
      new Dimension(width, progressTotal.getPreferredSize().height*6));
  scroller.setPreferredSize(
      new Dimension(width, progressTotal.getPreferredSize().height*6));
  

  add(Box.createVerticalGlue());
  add(message);
  add(Box.createVerticalStrut(5));
  add(progressTotal);
  add(Box.createVerticalStrut(10));
  add(dlMsg);
  add(Box.createVerticalStrut(5));
  add(scroller);

  add(Box.createVerticalGlue());

  addComponentListener(this);
}
 
源代码19 项目: Math-Game   文件: WorkspacePanel.java
/**
 * @param fr - The JFrame that this dialog originates from
 * @param answer - The answer to the equation
 * @param equation - The equation to display
 */
public AnswerDialog(JFrame fr, Double answer, String equation) {
	super(fr, true);
	this.answer = answer;
	this.equation = equation;
	
	text = new JTextField(10); // Size 10 font
	text.addActionListener(this);
	
	incorrect = new JLabel("Incorrect");
	
	cancel = new JButton("Cancel");
	cancel.addActionListener(this);
	
	panel = new JPanel();
	panel.add(new JLabel(this.equation));
	panel.add(text);
	panel.add(incorrect);
	panel.add(cancel);
	
	incorrect.setVisible(false);
	
	setContentPane(panel);
	setAutoRequestFocus(true);
	
	/*
	addWindowListener(new WindowAdapter()	{
		public void windowClosing(WindowEvent we)	{
			option.setValue(new Integer(JOptionPane.CLOSED_OPTION));
		}
	});
	*/
	
	addComponentListener(new ComponentAdapter() {
		public void componentShown(ComponentEvent ce) {
			text.requestFocusInWindow();
		}
	});
	
	addWindowStateListener(new WindowStateListener() {
		@Override
		public void windowStateChanged(WindowEvent we) {
			isCorrect = false;
		}
	});
}
 
源代码20 项目: stendhal   文件: StatusIconPanel.java
/**
 * Display or hide a status icon.
 *
 * @param ID
 *      The ID value of the status
 * @param visible
 *      Show the icon
 */
void setStatus(final StatusID ID, final boolean visible) {
    final JLabel status = statusIDMap.get(ID);
    if (status.isVisible() != visible) {
        status.setVisible(visible);
    }
}