本文整理汇总了Java中javax.swing.JLabel.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setVisible方法的具体用法?Java JLabel.setVisible怎么用?Java JLabel.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponents
import javax.swing.JLabel; //导入方法依赖的package包/类
protected void initComponents() {
removeAll();
setLayout(new BorderLayout());
WarningScrollTable wST = new WarningScrollTable(csTable, WARNING_CLASS);
setBorder(new TitledBorder(new EtchedBorder(), "CS Strategies"));
setMinimumSize(new Dimension(180, 100));
descriptionLabel = new JLabel(DESCRIPTION);
normalizzationErrorLabel = new JLabel(NORMALIZATION_ERROR);
normalizzationWarningLabel = new JLabel(NORMALIZATION_WARNING);
checkRowLessThanOne();
add(wST, BorderLayout.CENTER);
add(descriptionLabel, BorderLayout.SOUTH);
JPanel msgPanel = new JPanel(new BorderLayout());
msgPanel.add(normalizzationErrorLabel, BorderLayout.NORTH);
msgPanel.add(normalizzationWarningLabel, BorderLayout.SOUTH);
add(msgPanel, BorderLayout.NORTH);
if (descriptionLabel != null) {
descriptionLabel.setVisible(classData.getClassKeys().size() != 0);
}
}
示例2: InputDataPanel
import javax.swing.JLabel; //导入方法依赖的package包/类
public InputDataPanel(List<String> previouslyUsedURLs) {
setSize(new Dimension(900, 300));
setPreferredSize(new Dimension(900, 300));
setMinimumSize(new Dimension(450, 300));
setLayout(null);
JLabel lblInputDataUrl = new JLabel("Input data URL");
lblInputDataUrl.setBounds(12, 12, 105, 15);
add(lblInputDataUrl);
lblUrlIsInvalid = new JLabel("URL is invalid!");
lblUrlIsInvalid.setVisible(false);
lblUrlIsInvalid.setBounds(12, 70, 105, 15);
add(lblUrlIsInvalid);
btnValidate = new JButton("Validate");
btnValidate.setBounds(335, 34, 93, 25);
//add(btnValidate);
comboBox = new JComboBox();
comboBox.setEditable(true);
comboBox.setBounds(12, 34, 311, 24);
comboBox.setModel(new URLComboBoxModel(previouslyUsedURLs));
add(comboBox);
}
示例3: doComboBoxAction
import javax.swing.JLabel; //导入方法依赖的package包/类
@Override
protected void doComboBoxAction() {
if (comboBox.getSelectedIndex() > 0) {
// get the params of the selected resource type.
paramNames = new ArrayList<String>();
paramValues = new ArrayList<JTextField>();
for (final Method m : ((ComboBoxClass) comboBox.getSelectedItem())
.getClasss().getDeclaredMethods()) {
// for every setter method get the name of the parameter to set
// and display it as a label along with a text field for setting
// the value.
if (m.isAnnotationPresent(ExchangeParameter.class)
&& m.getName().startsWith("set")) {
String name = m.getName().substring(3).toLowerCase();
paramNames.add(name);
JLabel paramName = new JLabel(name.replaceFirst("demanded",
"demanded "));
paramName.setVisible(true);
paramsPanel.add(paramName);
JTextField paramValue = new JTextField(3);
paramValue.setEditable(true);
paramValue.setVisible(true);
paramValues.add(paramValue);
paramsPanel.add(paramValue);
paramValue.requestFocus();
}
}
}
}
示例4: eliminarEntidadSeleccionada
import javax.swing.JLabel; //导入方法依赖的package包/类
public void eliminarEntidadSeleccionada (){
JLabel entidadAeliminar= (JLabel) moverComp.getUltimoComponenteSeleccionado();
// escenrioSimComp.eliminarEntidad(((JLabel)moverComp.eliminarUltimoCompSeleccionado()).getName());
// moverComp.deregisterComponent(entidadAeliminar);
entidadAeliminar.setVisible(false);
escenarioActualComp.eliminarEntidad(entidadAeliminar.getText());
listaEntidadesEnEscenario.remove(entidadAeliminar);
System.out.println( "Se elimina la entidad : "+entidadAeliminar.getText()+ " Coordenadas : X =" + entidadAeliminar.getX() +" , Y = " +entidadAeliminar.getY() );
actualizarInfoEquipoEnEscenario ();
}
示例5: hideLabelAndLabelFor
import javax.swing.JLabel; //导入方法依赖的package包/类
public static void hideLabelAndLabelFor(JComponent component, String lab) {
JLabel label = findLabel(component, lab);
if (label != null) {
label.setVisible(false);
Component c = label.getLabelFor();
if (c != null) {
c.setVisible(false);
}
}
}
示例6: addLoadingLabel
import javax.swing.JLabel; //导入方法依赖的package包/类
private void addLoadingLabel() {
editor.setLayout(new BorderLayout());
loadingLabel = new JLabel(NbBundle.getMessage(CloneableEditor.class, "LBL_EditorLoading")); // NOI18N
loadingLabel.setOpaque(true);
loadingLabel.setHorizontalAlignment(SwingConstants.CENTER);
loadingLabel.setBorder(new EmptyBorder(new Insets(11, 11, 11, 11)));
loadingLabel.setVisible(false);
editor.add(loadingLabel, BorderLayout.CENTER);
}
示例7: Sectors3DPanel
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* Builds a new Sectors3D Panel to show results of 3-class models
* @param s3d results vector
* @param classNames array with class names
*/
public Sectors3DPanel(Vector<Object> s3d, String[] classNames) {
super(new BorderLayout());
this.s3d = s3d;
this.classNames = classNames;
this.setBackground(BGCOLOR);
this.setBorder(BorderFactory.createEtchedBorder());
// Label to show coordinates
coordLabel = new JLabel();
coordLabel.setBorder(BorderFactory.createEtchedBorder());
coordLabel.setVisible(false);
coordLabel.setOpaque(true);
// Puts label on south-east corner
JPanel tmp = new JPanel(new BorderLayout());
tmp.add(coordLabel, BorderLayout.EAST);
tmp.setOpaque(false);
this.add(tmp, BorderLayout.SOUTH);
// Adds a mouseListener to show graph coordinates
this.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
if (isShown) {
String coord = getCoordinates(e.getX(), e.getY());
if (coord != null) {
coordLabel.setText(coord);
coordLabel.setVisible(true);
Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
} else {
coordLabel.setText("");
coordLabel.setVisible(false);
Sectors3DPanel.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
}
});
}
示例8: getJLabelDefault
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* Criar JLabel padrão para as animações
*
* @return JLabel padrão
*/
private JLabel getJLabelDefault() {
JLabel retorno = new JLabel("", SwingConstants.CENTER) {
@Override
public String toString() {
return card.getToString();
}
};
retorno.setSize(SIZE);
retorno.setPreferredSize(SIZE);
retorno.setVisible(false);
return retorno;
}
示例9: initialize
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.gridx = 0;
gridBagConstraints3.anchor = GridBagConstraints.WEST;
gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints3.insets = new Insets(2, 2, 2, 2);
gridBagConstraints3.gridy = 0;
jLabel = new JLabel();
jLabel.setText("prefix:");
jLabel.setVisible(false);
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.weightx = 1.0;
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.insets = new Insets(2, 2, 2, 2);
gridBagConstraints21.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.gridx = 1;
gridBagConstraints11.gridy = 1;
gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints11.weightx = 1.0;
gridBagConstraints11.insets = new Insets(2, 2, 2, 2);
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.insets = new Insets(2, 2, 2, 2);
gridBagConstraints1.fill = GridBagConstraints.BOTH;
gridBagConstraints1.weightx = 1.0;
gridBagConstraints1.gridy = 1;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 0;
gridBagConstraints2.insets = new Insets(2, 2, 2, 2);
gridBagConstraints2.fill = GridBagConstraints.BOTH;
gridBagConstraints2.weightx = 1.0;
gridBagConstraints2.gridy = 3;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.insets = new Insets(2, 2, 2, 2);
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridy = 3;
this.setSize(287, 230);
this.setLayout(new GridBagLayout());
//this.setBorder(BorderFactory.createTitledBorder(null, "export", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
this.add(getInDegreeDistributionButton(), gridBagConstraints);
this.add(getOutDegreeNodeButton(), gridBagConstraints1);
this.add(getEdgeInfoButton(), gridBagConstraints11);
this.add(getEdgeInfoTextField(), gridBagConstraints21);
this.add(jLabel, gridBagConstraints3);
}
示例10: getCustomEditor
import javax.swing.JLabel; //导入方法依赖的package包/类
@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;
}
示例11: createProgressComponent
import javax.swing.JLabel; //导入方法依赖的package包/类
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;
}
示例12: initialize
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* This method initializes this
*/
private void initialize() {
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.gridx = 2;
gridBagConstraints2.gridy = 0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.fill = GridBagConstraints.BOTH;
gridBagConstraints1.insets = new Insets(10, 0, 10, 10);
gridBagConstraints1.weightx = 1.0;
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.insets = new Insets(10, 10, 10, 5);
gridBagConstraints.gridy = 0;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.fill = GridBagConstraints.BOTH;
gridBagConstraints6.gridwidth = 5;
gridBagConstraints6.gridx = 0;
gridBagConstraints6.gridy = 1;
gridBagConstraints6.weightx = 1.0;
gridBagConstraints6.weighty = 1.0;
gridBagConstraints6.insets = new Insets(0, 10, 0, 10);
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.fill = GridBagConstraints.BOTH;
gridBagConstraints5.gridx = 1;
gridBagConstraints5.gridy = 0;
gridBagConstraints5.weightx = 1.0;
gridBagConstraints5.anchor = GridBagConstraints.CENTER;
gridBagConstraints5.weighty = 0.0;
gridBagConstraints5.insets = new Insets(10, 0, 10, 10);
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.insets = new Insets(10, 10, 10, 5);
gridBagConstraints4.gridy = 0;
gridBagConstraints4.anchor = GridBagConstraints.WEST;
gridBagConstraints4.gridx = 0;
jLabelDummy = new JLabel();
jLabelDummy.setText(" ");
jLabelClassDescCaption = new JLabel();
jLabelClassDescCaption.setText("Text");
jLabelClassDescCaption.setVisible(false);
jLabelClassNameCaption = new JLabel();
jLabelClassNameCaption.setText("Name:");
jLabelClassNameCaption.setFont(new Font("Dialog", Font.BOLD, 12));
this.setSize(392, 238);
this.setLayout(new GridBagLayout());
this.add(jLabelClassNameCaption, gridBagConstraints4);
this.add(getJTextFieldClassName(), gridBagConstraints5);
this.add(getJScrollPaneClassSlots(), gridBagConstraints6);
this.add(jLabelClassDescCaption, gridBagConstraints);
this.add(getJTextFieldClassDescription1(), gridBagConstraints1);
this.add(jLabelDummy, gridBagConstraints2);
}
示例13: MarioError
import javax.swing.JLabel; //导入方法依赖的package包/类
public MarioError(String errorMessage){
super("ERROR");
//applicable for multi monitor workstations
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
screenWidth = gd.getDisplayMode().getWidth();
screenHight = gd.getDisplayMode().getHeight();
this.setLocation((int)((screenWidth - frameWidth)*0.5), (int)(screenHight*0.25));
this.setSize(frameWidth , (int)(screenHight*0.5));
this.getContentPane().setLayout(new GridBagLayout());
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
titleLabel = new JLabel();
titleLabel.setText("Unfortunately an Error occured");
titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
titleLabel.setFont(new Font(titleLabel.getFont().getFontName(), Font.BOLD, 32));
titleLabel.setForeground(Color.RED);
titleLabel.setVisible(true);
LayoutHelper.putGrid(this, titleLabel, 0, 0, 2,1, 1.0, 1.0);
errorText = new JTextArea();
errorText.setText(errorMessage);
errorText.setWrapStyleWord(true);
errorText.setLineWrap(true);
errorText.setEditable(false);
errorText.setFont(new Font(errorText.getFont().getFontName(), Font.BOLD, 20));
errorText.setVisible(true);
errorScrollPane = new JScrollPane(errorText);
errorText.setCaretPosition(0);
LayoutHelper.putGrid(this, errorScrollPane, 0, 1, 2,1, 1.0, 1.0);
helpButton = new JButton("HELP");
helpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (Desktop.isDesktopSupported()) {
try {
File myFile = new File("D:/Data/Desktop/Mario SoSe15 Einf�hrung/MarioHelp.pdf");
Desktop.getDesktop().open(myFile);
} catch (IOException ex) {
new MarioError("Could not find help file");
}
}
}
});
LayoutHelper.putGrid(this, helpButton, 0, 2, 2,1, 1.0, 0.2);
this.setVisible(true);
}
示例14: DataPane
import javax.swing.JLabel; //导入方法依赖的package包/类
/**
* Create the panel.
*/
public DataPane()
{
JLabel taskLabel = new JLabel("Wir brauchen einige Daten über Sie.");
JLabel nameLabel = new JLabel("Name");
nameField = new JTextField();
nameField.setColumns(10);
JLabel mailLabel = new JLabel("Mail-Adresse");
mailField = new JTextField();
mailField.setColumns(10);
JButton btnWeiter = new JButton("weiter");
btnWeiter.setActionCommand("weiter");
btnWeiter.addActionListener(new ActionHandler());
JButton btnAbbrechen = new JButton("abbrechen");
btnAbbrechen.setActionCommand("abbrechen");
btnAbbrechen.addActionListener(new ActionHandler());
errorLabel = new JLabel("Error");
errorLabel.setVisible(false);
errorLabel.setForeground(Color.RED);
GroupLayout groupLayout = new GroupLayout(this);
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout
.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(taskLabel))
.addGroup(groupLayout.createSequentialGroup()
.addGap(35).addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
.addComponent(nameLabel).addComponent(mailLabel))
.addGap(91)
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
.addComponent(mailField).addComponent(nameField, 144, 144, Short.MAX_VALUE)))
.addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(btnAbbrechen)
.addPreferredGap(ComponentPlacement.RELATED, 236, Short.MAX_VALUE)
.addComponent(btnWeiter))
.addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(errorLabel)))
.addContainerGap()));
groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
.createSequentialGroup().addContainerGap().addComponent(taskLabel).addGap(53)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(nameLabel).addComponent(
nameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(41)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(mailLabel).addComponent(
mailField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addPreferredGap(ComponentPlacement.RELATED, 63, Short.MAX_VALUE).addComponent(errorLabel).addGap(26)
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnWeiter)
.addComponent(btnAbbrechen))
.addContainerGap()));
setLayout(groupLayout);
}
示例15: ProgressPanel
import javax.swing.JLabel; //导入方法依赖的package包/类
public ProgressPanel() {
super();
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
progressTotal = new SafeJProgressBar();
progressTotal.setAlignmentX(CENTER_ALIGNMENT);
progressTotal.setMaximumSize(new Dimension(250, progressTotal
.getPreferredSize().height));
progressTotal.setIndeterminate(true);
progressSingle = new SafeJProgressBar();
progressSingle.setAlignmentX(CENTER_ALIGNMENT);
progressSingle.setMaximumSize(new Dimension(250, progressTotal
.getPreferredSize().height));
progressSingle.setIndeterminate(true);
progressSingle.setVisible(false);
progressSingle.setMinimum(0);
progressSingle.setMaximum(100);
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);
add(Box.createVerticalGlue());
add(message);
add(Box.createVerticalStrut(5));
add(progressTotal);
add(Box.createVerticalStrut(10));
add(dlMsg);
add(Box.createVerticalStrut(5));
add(progressSingle);
add(Box.createVerticalGlue());
addComponentListener(this);
}