Java Code Examples for javax.swing.JLabel#setLabelFor()

The following examples show how to use javax.swing.JLabel#setLabelFor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapSizeDialog.java    From freecol with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a dialog to choose the map size.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 */
public MapSizeDialog(FreeColClient freeColClient, JFrame frame) {
    super(freeColClient, frame);

    JLabel widthLabel = Utility.localizedLabel("width");
    widthLabel.setLabelFor(inputWidth);
    JLabel heightLabel = Utility.localizedLabel("height");
    heightLabel.setLabelFor(inputHeight);

    JPanel panel = new MigPanel(new MigLayout("wrap 2"));
    panel.add(Utility.localizedHeader("mapSizeDialog.mapSize", true),
              "span, align center");
    panel.add(widthLabel, "newline 20");
    panel.add(inputWidth);
    panel.add(heightLabel);
    panel.add(inputHeight);

    initializeInputDialog(frame, true, panel, null, "ok", "cancel");
}
 
Example 2
Source File: InjectionPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new injection panel
 *
 * @param parent
 * 		the parent window
 * @param type
 * 		the connection type
 * @param injectableParameters
 * 		injectable parameter supplier
 * @param valueProviders
 * 		names of the available value providers
 */
public InjectionPanel(Window parent, String type, Supplier<List<ConnectionParameterModel>> injectableParameters, List<ValueProvider> valueProviders, Consumer<List<ConnectionParameterModel>> saveCallback){
	super(new GridBagLayout());

	GridBagConstraints c = new GridBagConstraints();
	c.insets = new Insets(8, 10, 8, 16);
	c.anchor = GridBagConstraints.WEST;
	c.fill = GridBagConstraints.NONE;
	JLabel injectLabel = new JLabel(I18N.getGUIMessage("gui.action.inject_connection_parameter.tip"));
	injectLabel.setHorizontalAlignment(JLabel.LEFT);
	// Copy parameters
	JButton injectButton = new JButton(new InjectParametersAction(parent, type, injectableParameters, valueProviders, saveCallback));
	injectLabel.setLabelFor(injectButton);
	add(injectButton, c);

	c.weightx = 1;
	add(injectLabel, c);
}
 
Example 3
Source File: ModuleInstallerSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static JPanel searchingPanel(JLabel progressLabel, JComponent progressComponent) {
    JPanel panel = new JPanel();
    progressLabel.setLabelFor(progressComponent);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(panel);
    panel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                .addComponent(progressLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(progressComponent, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGap(96, 96, 96)
            .addComponent(progressLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(progressComponent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(109, Short.MAX_VALUE))
    );
    return panel;
}
 
Example 4
Source File: AbstractAdapterEditor.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
JComponent addTextField(JPanel parent, TextFieldEditor textEditor, String labelText,
                        String propertyName, boolean isRequired, String[] excludedChars) {
    JLabel jLabel = new JLabel(labelText);
    Dimension size = jLabel.getPreferredSize();
    parent.add(jLabel);
    PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName);
    if (isRequired) {
        propertyDescriptor.setValidator(new DecoratedNotEmptyValidator(jLabel, excludedChars));
        jLabel.setMaximumSize(new Dimension(size.width + 20, size.height));
    }
    JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext);
    UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here");
    UIUtils.enableUndoRedo(editorComponent);
    editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight));
    editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight));
    jLabel.setLabelFor(editorComponent);
    parent.add(editorComponent);
    return editorComponent;
}
 
Example 5
Source File: PropertiesTable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init(JLabel label, String[] columns, TableSorter sorter) {
    tableModel = new PropertiesTableModel(columns);
    tableModel.addTableModelListener(this);
    if(sorter == null) {
        sorter = new TableSorter(tableModel);
    } 
    this.sorter = sorter;   
    table = new SortedTable(this.sorter);
    table.getTableHeader().setReorderingAllowed(false);
    table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
    //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
    table.getTableHeader().setReorderingAllowed(true);
    table.setRowHeight(table.getRowHeight());
    table.addAncestorListener(this);
    component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    component.setPreferredSize(new Dimension(340, 150));
    table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N        
    label.setLabelFor(table);
    setColumns(columns);
}
 
Example 6
Source File: SelectHandlerPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initComponents() {
    panel = new JPanel();
    setLayout(new BorderLayout());
    BorderLayout bl = new BorderLayout();
    panel.setLayout(bl);
    bl.setVgap(10);
    add(panel, BorderLayout.CENTER);
    
    BeanTreeView btv = new BeanTreeView();
    btv.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    btv.getAccessibleContext().
            setAccessibleName(NbBundle.getMessage(SelectHandlerPanel.class,"LBL_Class_Tree"));
    btv.getAccessibleContext().setAccessibleDescription
            (NbBundle.getMessage(SelectHandlerPanel.class,"ACSD_SelectHandler"));
    String projectName = project.getProjectDirectory().getName();
    String classesLabel = projectName + " " +
            NbBundle.getMessage(SelectHandlerPanel.class, "LBL_PROJECT_CLASSES") + ":";
    JLabel label = new JLabel();
    org.openide.awt.Mnemonics.setLocalizedText(label, classesLabel);
    label.setLabelFor(btv.getViewport().getView());
    panel.add(label, BorderLayout.NORTH);
    panel.add(btv, BorderLayout.CENTER);   //NOI18N
    panel.validate();
    validate();
}
 
Example 7
Source File: FormatChartsViewer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
ControlPanel( FormatChartsViewer fcv )
{
	this.fcv = fcv;

	setLayout( new GridLayout( 0, 1, 0, 0 ) );

	JPanel jp = new JPanel( );
	jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) );

	JLabel choose=new JLabel( "Choose:" );//$NON-NLS-1$
	choose.setDisplayedMnemonic( 'c' );
	jp.add( choose );
	jcbModels = new JComboBox( );

	jcbModels.addItem( "Axis Format" );//$NON-NLS-1$
	jcbModels.addItem( "Colored By Category" );//$NON-NLS-1$
	jcbModels.addItem( "Legend & Title Format" );//$NON-NLS-1$
	jcbModels.addItem( "Percentage Values" );//$NON-NLS-1$
	jcbModels.addItem( "Plot Format" );//$NON-NLS-1$
	jcbModels.addItem( "Series Format" );//$NON-NLS-1$

	choose.setLabelFor( jcbModels );
	jcbModels.setSelectedIndex( 0 );
	jp.add( jcbModels );

	jbUpdate = new JButton( "Update" );//$NON-NLS-1$
	jbUpdate.setMnemonic( 'u' );
	jbUpdate.setToolTipText( "Update" );//$NON-NLS-1$
	jbUpdate.addActionListener( this );
	jp.add( jbUpdate );

	add( jp );
}
 
Example 8
Source File: IsotopePatternPreviewDialog.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
private void organizeParameterPanel() {
    lblMergeWidth = new JLabel(pMergeWidth.getName());
    lblMinIntensity = new JLabel(pMinIntensity.getName());
    lblFormula = new JLabel(pFormula.getName());
    lblCharge = new JLabel(pCharge.getName());
    lblStatus = new JLabel("Status");
    setStatus("Waiting.");

    mainPanel.remove(cmpCharge);
    mainPanel.remove(cmpMergeWidth);
    mainPanel.remove(cmpMinIntensity);
    mainPanel.remove(cmpFormula);

    lblFormula.setLabelFor(cmpFormula);
    lblMinIntensity.setLabelFor(cmpMinIntensity);
    lblMergeWidth.setLabelFor(cmpMergeWidth);
    lblCharge.setLabelFor(cmpCharge);
    
//    cmpCharge.setPreferredSize(new Dimension(30, cmpCharge.getHeight()));
    cmpCharge.setColumns(2);
    
    

    pnlParameters.add(lblFormula);
    pnlParameters.add(cmpFormula);
    pnlParameters.add(lblMinIntensity);
    pnlParameters.add(cmpMinIntensity);
    pnlParameters.add(lblMergeWidth);
    pnlParameters.add(cmpMergeWidth);
    pnlParameters.add(lblCharge);
    pnlParameters.add(cmpCharge);
    pnlParameters.add(lblStatus);
  }
 
Example 9
Source File: SwingInteractivityViewer.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
ControlPanel( SwingInteractivityViewer siv )
{
	this.siv = siv;

	setLayout( new GridLayout( 0, 1, 0, 0 ) );

	JPanel jp = new JPanel( );
	jp.setLayout( new FlowLayout( FlowLayout.LEFT, 3, 3 ) );

	JLabel choose = new JLabel( "Choose:" );//$NON-NLS-1$
	choose.setDisplayedMnemonic( 'c' );
	jp.add( choose );

	jcbModels = new JComboBox( );
	choose.setLabelFor( jcbModels );
	jcbModels.addItem( "Highlight Series" );//$NON-NLS-1$
	jcbModels.addItem( "Show Tooltip" );//$NON-NLS-1$
	jcbModels.addItem( "Toggle Visibility" );//$NON-NLS-1$
	jcbModels.addItem( "URL Redirect" );//$NON-NLS-1$
	jcbModels.addItem( "Multiple URLs Redirect" );//$NON-NLS-1$
	jcbModels.addItem( "Call Back" );//$NON-NLS-1$
	jcbModels.addItem( "Right Mouse Click" );//$NON-NLS-1$
	jcbModels.addItem( "Mouse Cursor" );//$NON-NLS-1$
	jcbModels.setSelectedIndex( 0 );
	jp.add( jcbModels );

	jbUpdate = new JButton( "Update" );//$NON-NLS-1$
	jbUpdate.setMnemonic( 'u' );
	jbUpdate.addActionListener( this );
	jbUpdate.setToolTipText( "Show" );//$NON-NLS-1$
	jp.add( jbUpdate );

	add( jp );
}
 
Example 10
Source File: RemotePrinterStatusRefresh.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private JPanel createInfoPanel() {
    JLabel javaLabel = new JLabel("Java version:");
    JTextField javaVersion =
            new JTextField(System.getProperty("java.runtime.version"));
    javaVersion.setEditable(false);
    javaLabel.setLabelFor(javaVersion);

    JLabel refreshTimeLabel = new JLabel("Refresh interval:");
    long minutes = refreshTime / 60;
    long seconds = refreshTime % 60;
    String interval = String.format("%1$d seconds%2$s",
            refreshTime,
            minutes > 0
                ? String.format(" (%1$d %2$s%3$s)",
                    minutes,
                    minutes > 1 ? "minutes" : "minute",
                    seconds > 0
                        ? String.format(" %1$d %2$s",
                            seconds,
                            seconds > 1 ? "seconds" : "second")
                        : "")
                : ""
    );
    JTextField refreshInterval = new JTextField(interval);
    refreshInterval.setEditable(false);
    refreshTimeLabel.setLabelFor(refreshInterval);

    JLabel nextRefreshLabel = new JLabel("Next printer refresh in:");
    nextRefresh = new JTextField();
    nextRefresh.setEditable(false);
    nextRefreshLabel.setLabelFor(nextRefresh);

    JLabel timeoutLabel = new JLabel("Time left:");
    timeLeft = new JTextField();
    timeLeft.setEditable(false);
    timeoutLabel.setLabelFor(timeLeft);

    JPanel infoPanel = new JPanel();
    GroupLayout layout = new GroupLayout(infoPanel);
    infoPanel.setLayout(layout);
    infoPanel.setBorder(BorderFactory.createTitledBorder("Info"));
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(javaLabel)
                .addComponent(refreshTimeLabel)
                .addComponent(nextRefreshLabel)
                .addComponent(timeoutLabel)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true)
                .addComponent(javaVersion)
                .addComponent(refreshInterval)
                .addComponent(nextRefresh)
                .addComponent(timeLeft)
            )
    );
    layout.setVerticalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(javaLabel)
                .addComponent(javaVersion)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(refreshTimeLabel)
                .addComponent(refreshInterval))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(nextRefreshLabel)
                .addComponent(nextRefresh))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(timeoutLabel)
                .addComponent(timeLeft))
    );
    return infoPanel;
}
 
Example 11
Source File: ClusteringAlgoPanel.java    From moa with GNU General Public License v3.0 4 votes vote down vote up
public void renderAlgoPanel(){

        setLayout(new BorderLayout());

        ArrayList<Option> options = new ArrayList<Option>();
        options.add(streamOption);
        options.add(algorithmOption0);
        options.add(algorithmOption1);

        JPanel optionsPanel = new JPanel();
        GridBagLayout gbLayout = new GridBagLayout();
        optionsPanel.setLayout(gbLayout);

        //Create generic label constraints
        GridBagConstraints gbcLabel = new GridBagConstraints();
        gbcLabel.gridx = 0;
        gbcLabel.fill = GridBagConstraints.NONE;
        gbcLabel.anchor = GridBagConstraints.EAST;
        gbcLabel.weightx = 0;
        gbcLabel.insets = new Insets(5, 5, 5, 5);

        //Create generic editor constraints
        GridBagConstraints gbcOption = new GridBagConstraints();
        gbcOption.gridx = 1;
        gbcOption.fill = GridBagConstraints.HORIZONTAL;
        gbcOption.anchor = GridBagConstraints.CENTER;
        gbcOption.weightx = 1;
        gbcOption.insets = new Insets(5, 5, 5, 0);

        //Stream Option
        JLabel labelStream = new JLabel("Stream");
        labelStream.setToolTipText("Stream to use.");
        optionsPanel.add(labelStream, gbcLabel);
        JComponent editorStream = getEditComponent(streamOption);
        labelStream.setLabelFor(editorStream);
        editComponents.add((OptionEditComponent) editorStream);
        optionsPanel.add(editorStream, gbcOption);

        //Algorithm0 Option
        JLabel labelAlgo0 = new JLabel("Algorithm1");
        labelAlgo0.setToolTipText("Algorithm to use.");
        optionsPanel.add(labelAlgo0, gbcLabel);
        JComponent editorAlgo0 = getEditComponent(algorithmOption0);
        labelAlgo0.setLabelFor(editorAlgo0);
        editComponents.add((OptionEditComponent) editorAlgo0);
        optionsPanel.add(editorAlgo0, gbcOption);

        //Algorithm1 Option
        JLabel labelAlgo1 = new JLabel("Algorithm2");
        labelAlgo1.setToolTipText("Comparison algorithm to use.");
        optionsPanel.add(labelAlgo1, gbcLabel);
        JComponent editorAlgo1 = getEditComponent(algorithmOption1);
        labelAlgo1.setLabelFor(editorAlgo1);
        editComponents.add((OptionEditComponent) editorAlgo1);
        optionsPanel.add(editorAlgo1, gbcOption);

        //use comparison Algorithm Option
        GridBagConstraints gbcClearButton = new GridBagConstraints();
        gbcClearButton.gridx = 2;
        gbcClearButton.gridy = 2;
        gbcClearButton.fill = GridBagConstraints.NONE;
        gbcClearButton.anchor = GridBagConstraints.CENTER;
        gbcClearButton.insets = new Insets(5, 0, 5, 5);

        JButton clearButton = new JButton("Clear");
        clearButton.addActionListener(this);
        clearButton.setActionCommand("clear");
        optionsPanel.add(clearButton, gbcClearButton);


        add(optionsPanel);
    }
 
Example 12
Source File: DDChangesPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Initializes the Form */
public DDChangesPanel (String caption, final JButton processButton) {
    setLayout (new java.awt.BorderLayout (0, 12));
    setBorder (new EmptyBorder (12, 12, 11, 0));
    
    JTextArea text = new JTextArea ();
    text.setEnabled (false);
    text.setEditable (false);
    text.setDisabledTextColor (UIManager.getColor ("Label.foreground")); // NOI18N
    text.setBackground (UIManager.getColor ("Label.background")); // NOI18N
    text.setLineWrap (true);
    text.setWrapStyleWord (true);
    text.setText (caption);
    add (text, "North"); // NOI18N
    
    changesPanel = new JPanel ();
    changesPanel.setLayout (new java.awt.BorderLayout (5, 5));
    
    JLabel changesLabel = new JLabel ();
    changesLabel.setText (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList"));
    changesLabel.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yDesc"));  // NOI18N
    changesPanel.add (changesLabel, "North"); // NOI18N
    
    jScrollPane1 = new JScrollPane ();
    
    listModel = new DefaultListModel ();
    
    changesList = new JList (listModel);
    changesList.setToolTipText (NbBundle.getMessage (DDChangesPanel.class, "HINT_ChangesList"));
    changesList.setCellRenderer (new ChangesListCellRenderer ());
    changesList.addListSelectionListener (new ListSelectionListener () {
        public void valueChanged (ListSelectionEvent e) {
            processButton.setEnabled (!changesList.isSelectionEmpty ());
        }
    });
    changesLabel.setLabelFor (changesList);
    changesLabel.setDisplayedMnemonic (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList_Mnemonic").charAt (0));
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yPanelDesc"));
    
    jScrollPane1.setViewportView (changesList);
    
    changesPanel.add (jScrollPane1, "Center"); // NOI18N
    
    add (changesPanel, "Center"); // NOI18N
}
 
Example 13
Source File: ProfilerOptionsContainer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initUI() {
    categoriesModel = new CategoriesListModel();
    categoriesSelection = new CategoriesSelectionModel();
    
    scrollIncrement = new JCheckBox("XXX").getPreferredSize().height; // NOI18N
    
    JList<ProfilerOptionsPanel> categoriesList = new JList<ProfilerOptionsPanel>(categoriesModel) {
        public Dimension getPreferredSize() {
            Dimension dim = super.getPreferredSize();
            dim.width = Math.max(dim.width + 20, 140);
            return dim;
        }
    };
    categoriesList.setVisibleRowCount(0);
    categoriesList.setSelectionModel(categoriesSelection);
    categoriesList.setCellRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            String panelName = " " + ((ProfilerOptionsPanel)value).getDisplayName() + " "; // NOI18N
            return super.getListCellRendererComponent(list, panelName, index, isSelected, cellHasFocus);
        }
    });
    
    JScrollPane categoriesScroll = new JScrollPane(categoriesList);
    
    JLabel categoriesLabel = new JLabel();
    categoriesLabel.setHorizontalAlignment(JLabel.LEADING);
    Mnemonics.setLocalizedText(categoriesLabel, Bundle.ProfilerOptionsContainer_Categories());
    categoriesLabel.setLabelFor(categoriesList);
    int labelOffset = 6;
    
    JPanel categoriesPanel = new JPanel(new BorderLayout(0, labelOffset));
    categoriesPanel.add(categoriesLabel, BorderLayout.NORTH);
    categoriesPanel.add(categoriesScroll, BorderLayout.CENTER);
    
    content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(categoriesLabel.getPreferredSize().height + labelOffset, 11, 0, 0));
    content.setMinimumSize(new Dimension(0, 0));
    content.setPreferredSize(new Dimension(0, 0));
    
    setLayout(new BorderLayout());
    add(categoriesPanel, BorderLayout.WEST);
    add(content, BorderLayout.CENTER);
}
 
Example 14
Source File: RemotePrinterStatusRefresh.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private JPanel createInfoPanel() {
    JLabel javaLabel = new JLabel("Java version:");
    JTextField javaVersion =
            new JTextField(System.getProperty("java.runtime.version"));
    javaVersion.setEditable(false);
    javaLabel.setLabelFor(javaVersion);

    JLabel refreshTimeLabel = new JLabel("Refresh interval:");
    long minutes = refreshTime / 60;
    long seconds = refreshTime % 60;
    String interval = String.format("%1$d seconds%2$s",
            refreshTime,
            minutes > 0
                ? String.format(" (%1$d %2$s%3$s)",
                    minutes,
                    minutes > 1 ? "minutes" : "minute",
                    seconds > 0
                        ? String.format(" %1$d %2$s",
                            seconds,
                            seconds > 1 ? "seconds" : "second")
                        : "")
                : ""
    );
    JTextField refreshInterval = new JTextField(interval);
    refreshInterval.setEditable(false);
    refreshTimeLabel.setLabelFor(refreshInterval);

    JLabel nextRefreshLabel = new JLabel("Next printer refresh in:");
    nextRefresh = new JTextField();
    nextRefresh.setEditable(false);
    nextRefreshLabel.setLabelFor(nextRefresh);

    JLabel timeoutLabel = new JLabel("Time left:");
    timeLeft = new JTextField();
    timeLeft.setEditable(false);
    timeoutLabel.setLabelFor(timeLeft);

    JPanel infoPanel = new JPanel();
    GroupLayout layout = new GroupLayout(infoPanel);
    infoPanel.setLayout(layout);
    infoPanel.setBorder(BorderFactory.createTitledBorder("Info"));
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(javaLabel)
                .addComponent(refreshTimeLabel)
                .addComponent(nextRefreshLabel)
                .addComponent(timeoutLabel)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, true)
                .addComponent(javaVersion)
                .addComponent(refreshInterval)
                .addComponent(nextRefresh)
                .addComponent(timeLeft)
            )
    );
    layout.setVerticalGroup(
        layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(javaLabel)
                .addComponent(javaVersion)
            )
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(refreshTimeLabel)
                .addComponent(refreshInterval))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(nextRefreshLabel)
                .addComponent(nextRefresh))
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                .addComponent(timeoutLabel)
                .addComponent(timeLeft))
    );
    return infoPanel;
}
 
Example 15
Source File: CreateBFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            Title of the frame.
 */
public CreateBFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 127, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 127, SpringLayout.WEST, calcPanel);
	JLabel l2 = new JLabel("Average flight altitude:", JLabel.TRAILING);
	calcPanel.add(l2);
	l2.setLabelFor(avgFlightAltitude);
	slPanel.putConstraint(SpringLayout.NORTH, l2, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l2, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(avgFlightAltitude);
	slPanel.putConstraint(SpringLayout.NORTH, avgFlightAltitude, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, avgFlightAltitude, 127, SpringLayout.WEST, calcPanel);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 107, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 110, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 127, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 127, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 155, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 160, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Migrates:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(migratesT);

	slPanel.putConstraint(SpringLayout.NORTH, l3, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(migratesT);
	slPanel.putConstraint(SpringLayout.NORTH, migratesT, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, migratesT, 127, SpringLayout.WEST, calcPanel);
	slPanel.putConstraint(SpringLayout.NORTH, migratesF, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, migratesF, 187, SpringLayout.WEST, calcPanel);
	calcPanel.add(migratesF);
	ButtonGroup group = new ButtonGroup();
	group.add(migratesT);
	group.add(migratesF);
	JLabel l6 = new JLabel("Choose bird:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(pelican);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(pelican);
	slPanel.putConstraint(SpringLayout.NORTH, pelican, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, pelican, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(whitestork);
	slPanel.putConstraint(SpringLayout.NORTH, whitestork, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, whitestork, 190, SpringLayout.WEST, calcPanel);
	calcPanel.add(eagle);
	slPanel.putConstraint(SpringLayout.NORTH, eagle, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, eagle, 280, SpringLayout.WEST, calcPanel);
	ButtonGroup group1 = new ButtonGroup();
	group1.add(pelican);
	group1.add(whitestork);
	group1.add(eagle);
}
 
Example 16
Source File: PropertyPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {

        JLabel keyLabel = new JLabel();
        JLabel valueLabel = new JLabel();
        JLabel commentLabel = new JLabel();

        keyText = new JTextField(25);
        valueText = new JTextField(25);
        commentText = new JTextField(25);

        keyLabel.setLabelFor(keyText);
        valueLabel.setLabelFor(valueText);
        commentLabel.setLabelFor(commentText);
        
        Mnemonics.setLocalizedText(keyLabel, NbBundle.getMessage(getClass(), "LBL_KeyLabel")); // NOI18N
        Mnemonics.setLocalizedText(valueLabel, NbBundle.getMessage(getClass(), "LBL_ValueLabel")); // NOI18N
        Mnemonics.setLocalizedText(commentLabel, NbBundle.getMessage(getClass(), "LBL_CommentLabel")); // NOI18N

        GroupLayout layout = new GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(LEADING)
                    .addComponent(keyLabel)
                    .addComponent(valueLabel)
                    .addComponent(commentLabel))
                .addPreferredGap(RELATED)
                .addGroup(layout.createParallelGroup(LEADING)
                    .addComponent(keyText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE)
                    .addComponent(valueText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE)
                    .addComponent(commentText, DEFAULT_SIZE, PREFERRED_SIZE, Short.MAX_VALUE))
                .addContainerGap()
        );
        layout.setVerticalGroup(
            layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(BASELINE)
                    .addComponent(keyLabel)
                    .addComponent(keyText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
                .addPreferredGap(RELATED)
                .addGroup(layout.createParallelGroup(BASELINE)
                    .addComponent(valueText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
                    .addComponent(valueLabel))
                .addPreferredGap(RELATED)
                .addGroup(layout.createParallelGroup(BASELINE)
                    .addComponent(commentText, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
                    .addComponent(commentLabel))
                .addContainerGap()
        );
    }
 
Example 17
Source File: Populate.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Run the app.
 * @param root root of the phadhail tree to add test data to
 * @param app application frame (may be null)
 */
public static void run(final File root, Frame app) {
    String msg = "How many files should I create?";
    String title = "Choose Size of Test Data";
    Integer[] sizes = new Integer[] {
        new Integer(5),
        new Integer(10),
        new Integer(25),
        new Integer(50),
        new Integer(100),
        new Integer(250),
        new Integer(500),
        new Integer(1000),
        new Integer(2500),
        new Integer(5000),
        new Integer(10000),
        new Integer(25000),
    };
    Integer def = new Integer(500);
    Integer i = (Integer)JOptionPane.showInputDialog(null, msg, title,
                                                     JOptionPane.QUESTION_MESSAGE,
                                                     null, sizes, def);
    if (i == null) {
        // Cancelled.
        return;
    }
    final int val = i.intValue();
    final JProgressBar progress = new JProgressBar(0, val);
    final JDialog dialog = new JDialog(app, "Creating test files...", true);
    dialog.getContentPane().setLayout(new FlowLayout());
    JLabel label = new JLabel("Creating files:");
    label.setLabelFor(progress);
    dialog.getContentPane().add(label);
    dialog.getContentPane().add(progress);
    dialog.pack();
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    new Thread(new Runnable() {
        public void run() {
            try {
                create(root, val, progress.getModel());
            } catch (IOException e) {
                e.printStackTrace();
            }
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    dialog.setVisible(false);
                }
            });
        }
    }, "Populating test files").start();
    dialog.setVisible(true);
}
 
Example 18
Source File: TransferFilesChooserVisual.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    selectFilesLabel = new JLabel();
    outerPanel = new EmbeddablePanel(filesChooserPanel);
    innerPanel = new JPanel();
    selectedFilesInfoLabel = new JLabel();
    warningLabel = new JLabel();

    selectFilesLabel.setLabelFor(outerPanel);



    Mnemonics.setLocalizedText(selectFilesLabel, NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.selectFilesLabel.text"));
    innerPanel.setLayout(new BorderLayout());
    Mnemonics.setLocalizedText(selectedFilesInfoLabel, "DUMMY");
    Mnemonics.setLocalizedText(warningLabel, "DUMMY");
    GroupLayout outerPanelLayout = new GroupLayout(outerPanel);
    outerPanel.setLayout(outerPanelLayout);

    outerPanelLayout.setHorizontalGroup(
        outerPanelLayout.createParallelGroup(Alignment.LEADING)
        .addGroup(outerPanelLayout.createSequentialGroup()
            .addComponent(selectedFilesInfoLabel)
            .addPreferredGap(ComponentPlacement.RELATED, 402, Short.MAX_VALUE)
            .addComponent(warningLabel))
        .addComponent(innerPanel, GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
    );
    outerPanelLayout.setVerticalGroup(
        outerPanelLayout.createParallelGroup(Alignment.LEADING)
        .addGroup(Alignment.TRAILING, outerPanelLayout.createSequentialGroup()
            .addComponent(innerPanel, GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(outerPanelLayout.createParallelGroup(Alignment.BASELINE)
                .addComponent(selectedFilesInfoLabel)
                .addComponent(warningLabel)))
    );

    innerPanel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.innerPanel.AccessibleContext.accessibleName")); // NOI18N
    innerPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.innerPanel.AccessibleContext.accessibleDescription")); // NOI18N
    selectedFilesInfoLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.selectedFilesInfoLabel.AccessibleContext.accessibleName")); // NOI18N
    selectedFilesInfoLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.selectedFilesInfoLabel.AccessibleContext.accessibleDescription")); // NOI18N
    warningLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.warningLabel.AccessibleContext.accessibleName")); // NOI18N
    warningLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.warningLabel.AccessibleContext.accessibleDescription")); // NOI18N
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setHorizontalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(Alignment.LEADING)
                .addComponent(outerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(selectFilesLabel))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(selectFilesLabel)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(outerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    );

    selectFilesLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.selectFilesLabel.AccessibleContext.accessibleName")); // NOI18N
    selectFilesLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.selectFilesLabel.AccessibleContext.accessibleDescription")); // NOI18N
    outerPanel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.outerPanel.AccessibleContext.accessibleName")); // NOI18N
    outerPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.outerPanel.AccessibleContext.accessibleDescription")); // NOI18N
    getAccessibleContext().setAccessibleName(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.AccessibleContext.accessibleName")); // NOI18N
    getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(TransferFilesChooserVisual.class, "TransferFilesChooserVisual.AccessibleContext.accessibleDescription")); // NOI18N
}
 
Example 19
Source File: CreateCFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            The title of the frame.
 */
public CreateCFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 5, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 90, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("ID:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(id);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 20, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(id);
	slPanel.putConstraint(SpringLayout.NORTH, id, 20, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, id, 90, SpringLayout.WEST, calcPanel);
	id.setText(UUID.randomUUID().toString());
	JLabel l4 = new JLabel("Salary:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(salary);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 40, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(salary);
	slPanel.putConstraint(SpringLayout.NORTH, salary, 40, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, salary, 90, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Working hours:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(workingHours);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 60, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(workingHours);
	slPanel.putConstraint(SpringLayout.NORTH, workingHours, 60, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, workingHours, 90, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 105, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 150, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Alive?:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(alive);
	alive.setSelected(true);
	slPanel.putConstraint(SpringLayout.NORTH, l3, 80, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(alive);
	slPanel.putConstraint(SpringLayout.NORTH, alive, 80, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, alive, 90, SpringLayout.WEST, calcPanel);

}
 
Example 20
Source File: AddJspWatchAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void performAction () {
        ResourceBundle bundle = NbBundle.getBundle (AddJspWatchAction.class);

        JPanel panel = new JPanel();
        panel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_WatchPanel")); // NOI18N
        JTextField textField;
        JLabel textLabel = new JLabel (bundle.getString ("CTL_Watch_Name")); // NOI18N
        textLabel.setBorder (new EmptyBorder (0, 0, 0, 10));
        panel.setLayout (new BorderLayout ());
        panel.setBorder (new EmptyBorder (11, 12, 1, 11));
        panel.add ("West", textLabel); // NOI18N
        panel.add ("Center", textField = new JTextField (25)); // NOI18N
        textField.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Watch_Name")); // NOI18N
        textField.setBorder (
            new CompoundBorder (textField.getBorder (), 
            new EmptyBorder (2, 0, 2, 0))
        );
        textLabel.setDisplayedMnemonic (
            bundle.getString ("CTL_Watch_Name_Mnemonic").charAt (0) // NOI18N
        );


        String t = null;//Utils.getELIdentifier();
//        Utils.log("Watch: ELIdentifier = " + t);
        
        boolean isScriptlet = Utils.isScriptlet();
        Utils.log("Watch: isScriptlet: " + isScriptlet);
        
        if ((t == null) && (isScriptlet)) {
            t = Utils.getJavaIdentifier();
            Utils.log("Watch: javaIdentifier = " + t);
        }
        
        if (t != null) {
            textField.setText(t);
        } else {
            textField.setText(watchHistory);
        }
        textField.selectAll ();        
        textLabel.setLabelFor (textField);
        textField.requestFocus ();

        org.openide.DialogDescriptor dd = new org.openide.DialogDescriptor (
            panel, 
            bundle.getString ("CTL_Watch_Title") // NOI18N
        );
        dd.setHelpCtx (new HelpCtx ("debug.add.watch"));
        Dialog dialog = DialogDisplayer.getDefault ().createDialog (dd);
        dialog.setVisible(true);
        dialog.dispose ();

        if (dd.getValue() != org.openide.DialogDescriptor.OK_OPTION) return;
        String watch = textField.getText();
        if ((watch == null) || (watch.trim ().length () == 0)) {
            return;
        }
        
        String s = watch;
        int i = s.indexOf (';');
        while (i > 0) {
            String ss = s.substring (0, i).trim ();
            if (ss.length () > 0)
                DebuggerManager.getDebuggerManager ().createWatch (ss);
            s = s.substring (i + 1);
            i = s.indexOf (';');
        }
        s = s.trim ();
        if (s.length () > 0)
            DebuggerManager.getDebuggerManager ().createWatch (s);
        
        watchHistory = watch;
        
        // open watches view
//        new WatchesAction ().actionPerformed (null); TODO
    }