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

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

源代码1 项目: netbeans   文件: TableUISupport.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    DisabledReason disabledReason = null;
    Object displayName = null;

    if (value instanceof Table) {
        Table tableItem = (Table)value;
        disabledReason = tableItem.getDisabledReason();
        if (disabledReason!= null) {
            displayName = NbBundle.getMessage(TableUISupport.class, "LBL_TableNameWithDisabledReason", tableItem.getName(), disabledReason.getDisplayName());
        } else {
            if(tableItem.isTable())
                displayName = tableItem.getName();
            else
                displayName = tableItem.getName() + NbBundle.getMessage(TableUISupport.class, "LBL_DB_VIEW");
        }
    }

    JLabel component = (JLabel)super.getListCellRendererComponent(list, displayName, index, isSelected, cellHasFocus);
    boolean needDisable = (disabledReason instanceof Table.NoPrimaryKeyDisabledReason) || (disabledReason instanceof Table.ExistingNotInSourceDisabledReason) || 
            (filter.equals(FilterAvailable.NEW) && (disabledReason instanceof Table.ExistingDisabledReason)) ||
            (filter.equals(FilterAvailable.UPDATE) && (disabledReason==null));
    component.setEnabled(!needDisable);
    component.setToolTipText(disabledReason != null ? disabledReason.getDescription() : null);

    return component;
}
 
源代码2 项目: netbeans   文件: ConfigFilesUIs.java
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JLabel component = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
    File file = (File)value;
    String displayNameText = (file != null) ? displayName.getDisplayName(file) : null;
    component.setText(displayNameText);
    if (!(table.getModel() instanceof ConfigFileSelectionTableModel)) {
        return component;
    }
    ConfigFileSelectionTableModel model = (ConfigFileSelectionTableModel)table.getModel();
    String toolTipText = null;
    if (!model.isEnabled(row)) {
        toolTipText = NbBundle.getMessage(ConfigFilesUIs.class, "LBL_FileAlreadyAdded");
    }
    component.setToolTipText(toolTipText);
    component.setEnabled(model.isEnabled(row));
    return component;
}
 
源代码3 项目: netbeans   文件: Utils.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                                              boolean cellHasFocus) {
    JLabel renderer = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    renderer.setBorder(BorderFactory.createEmptyBorder(1, 7, 1, 5));

    if (value instanceof ProfilingPoint) {
        boolean enabled = ((ProfilingPoint) value).isEnabled();
        renderer.setText(((ProfilingPoint) value).getName());
        renderer.setIcon(enabled ? ((ProfilingPoint) value).getFactory().getIcon() :
                                   ((ProfilingPoint) value).getFactory().getDisabledIcon());
        renderer.setEnabled(enabled);
    } else if (value instanceof ProfilingPointFactory) {
        renderer.setText(((ProfilingPointFactory) value).getType());
        renderer.setIcon(((ProfilingPointFactory) value).getIcon());
        renderer.setEnabled(true);
    } else {
        renderer.setIcon(null);
        renderer.setEnabled(true);
    }

    return renderer;
}
 
源代码4 项目: netbeans   文件: TaskListTopComponent.java
private Component createNoTasksMessage() {
    JPanel panel = new JPanel( new BorderLayout() );
    if( isMacLaf ) {
        panel.setBackground(macBackground);
    } else {
        Color background = UIManager.getColor("TextArea.background"); //NOI18N
        if( null != background )
            panel.setBackground( background );
    }
    JLabel msg = new JLabel( NbBundle.getMessage(TaskListTopComponent.class, "LBL_NoTasks" ) ); //NOI18N
    msg.setHorizontalAlignment(JLabel.CENTER);
    msg.setEnabled(false);
    msg.setOpaque(false);
    panel.add( msg, BorderLayout.CENTER );
    return panel;
}
 
源代码5 项目: azure-devops-intellij   文件: MergeBranchForm.java
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1));
    sourceBranchLabel = new JLabel();
    this.$$$loadLabelText$$$(sourceBranchLabel, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.Source"));
    contentPanel.add(sourceBranchLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    sourceText = new TextFieldWithBrowseButton.NoPathCompletion();
    contentPanel.add(sourceText, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label1 = new JLabel();
    label1.setEnabled(true);
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.Target"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    targetCombo = new JComboBox();
    contentPanel.add(targetCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    changesToMergePanel = new JPanel();
    changesToMergePanel.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.add(changesToMergePanel, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    changesToMergePanel.setBorder(BorderFactory.createTitledBorder(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("MergeBranchDialog.ChangesToMerge")));
    changesTypeCombo = new JComboBox();
    changesToMergePanel.add(changesTypeCombo, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    changesetsPanel = new JPanel();
    changesetsPanel.setLayout(new CardLayout(0, 0));
    changesToMergePanel.add(changesetsPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    label1.setLabelFor(targetCombo);
}
 
源代码6 项目: audiveris   文件: XactDataPane.java
/**
 * Creates a new {@code XactDataPane} object.
 *
 * @param title  pane title
 * @param parent parent pane if any
 * @param model  underlying model (cannot be null)
 */
public XactDataPane (String title,
                     XactDataPane parent,
                     Param<E> model)
{
    this.parent = parent;

    if (model == null) {
        throw new IllegalArgumentException("Null model for pane '" + title + "'");
    }

    this.model = model;
    this.title = title;
    separator = new JLabel(title);
    separator.setHorizontalAlignment(SwingConstants.LEFT);
    separator.setEnabled(false);
    selBox = new JCheckBox();
    selBox.addActionListener(this);
}
 
源代码7 项目: gate-core   文件: ResourceReferenceChooser.java
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  JLabel renderer = (JLabel)super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
  if(value instanceof PluginTreeNode) {
    renderer.setEnabled(true);
    renderer.setIcon(pluginIcon);
  } else if(value instanceof PluginResourceTreeNode) {
    PluginResourceTreeNode node = (PluginResourceTreeNode)value;
    if(!node.isLeaf() || ((PluginFileFilter)pluginFileFilterBox.getSelectedItem()).pattern.matcher(node.fullPath).find()) {
      renderer.setEnabled(true);
    } else {
      // trick lifted from DefaultTreeCellRenderer to get the right disabled icon
      Icon icon = renderer.getIcon();
      LookAndFeel laf = UIManager.getLookAndFeel();
      Icon disabledIcon = laf.getDisabledIcon(tree, icon);
      if (disabledIcon != null) icon = disabledIcon;
      renderer.setDisabledIcon(icon);
      renderer.setEnabled(false);
    }
  }
  return renderer;
}
 
源代码8 项目: jeddict   文件: TableUISupport.java
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    DisabledReason disabledReason = null;
    Object displayName = null;

    if (value instanceof Table) {
        Table tableItem = (Table) value;
        disabledReason = tableItem.getDisabledReason();
        if (disabledReason != null) {
            displayName = NbBundle.getMessage(TableUISupport.class, "LBL_TableNameWithDisabledReason", tableItem.getName(), disabledReason.getDisplayName());
        } else if (tableItem.isTable()) {
            displayName = tableItem.getName();
        } else {
            displayName = tableItem.getName() + NbBundle.getMessage(TableUISupport.class, "LBL_DB_VIEW");
        }
    }

    JLabel component = (JLabel) super.getListCellRendererComponent(list, displayName, index, isSelected, cellHasFocus);
    boolean needDisable = (disabledReason instanceof Table.NoPrimaryKeyDisabledReason)
            || (disabledReason instanceof Table.ExistingNotInSourceDisabledReason)
            || (disabledReason instanceof Table.ExistingDisabledReason);
    component.setEnabled(!needDisable);
    component.setToolTipText(disabledReason != null ? disabledReason.getDescription() : null);

    return component;
}
 
源代码9 项目: netbeans   文件: NoWebBrowserImpl.java
public NoWebBrowserImpl(String cause) {
    JLabel lbl = new JLabel(NbBundle.getMessage(NoWebBrowserImpl.class, "Err_CannotCreateBrowser", cause));
    lbl.setEnabled( false );
    lbl.setHorizontalAlignment( JLabel.CENTER );
    lbl.setVerticalAlignment( JLabel.CENTER );
    component = lbl;
}
 
源代码10 项目: snap-desktop   文件: PixelExtractionIOForm.java
public TimeExtractionPane(PropertyContainer container) {
    super(new BorderLayout(0, 5));

    final JCheckBox extractTime = createCheckBoxBinding(container.getProperty("extractTimeFromFilename"));

    final Property datePattern = container.getProperty("dateInterpretationPattern");
    final String dateDN = datePattern.getDescriptor().getDisplayName();
    final JPanel datePanel = new JPanel(new BorderLayout(0, 2));
    final JLabel dateLabel = new JLabel(dateDN + ":");
    final JTextField datePatternField = createTextFieldBinding(datePattern);
    dateLabel.setEnabled(false);
    datePatternField.setEnabled(false);
    datePanel.add(dateLabel, BorderLayout.NORTH);
    datePanel.add(datePatternField, BorderLayout.CENTER);

    final Property filenamePattern = container.getProperty("filenameInterpretationPattern");
    final String filenameDN = filenamePattern.getDescriptor().getDisplayName();
    final JPanel filenamePanel = new JPanel(new BorderLayout(0, 2));
    final JLabel filenameLabel = new JLabel(filenameDN + ":");
    final JTextField filenamePatternField = createTextFieldBinding(filenamePattern);
    filenameLabel.setEnabled(false);
    filenamePatternField.setEnabled(false);
    filenamePanel.add(filenameLabel, BorderLayout.NORTH);
    filenamePanel.add(filenamePatternField, BorderLayout.CENTER);

    extractTime.addChangeListener(e -> {
        final boolean selected = extractTime.isSelected();
        dateLabel.setEnabled(selected);
        datePatternField.setEnabled(selected);
        filenameLabel.setEnabled(selected);
        filenamePatternField.setEnabled(selected);
    });

    add(extractTime, BorderLayout.NORTH);
    add(datePanel, BorderLayout.CENTER);
    add(filenamePanel, BorderLayout.SOUTH);
}
 
源代码11 项目: IrScrutinizer   文件: IrpMasterBean.java
private void checkParam(JTextField textField, JLabel label, String parameterName, String oldValueStr) {
    if (protocol.hasParameter(parameterName)) {
        // TODO: check validity
        textField.setEnabled(true);
        label.setEnabled(true);
        if (!oldValueStr.equals(invalidParameterString))
            textField.setText(oldValueStr);
    } else {
        textField.setEnabled(false);
        label.setEnabled(false);
        textField.setText(null);
    }
}
 
源代码12 项目: pumpernickel   文件: IOLocationTileList.java
public Component getListCellRendererComponent(JList list, IOLocation l,
		int index, boolean isSelected, boolean cellHasFocus) {
	String text = "";
	BufferedImage image;

	text = l.getName();
	image = getGraphicCache().requestThumbnail(l);
	if (image == null) {
		if (l.isDirectory()) {
			image = LocationPane.FOLDER_THUMBNAIL;
		} else {
			image = LocationPane.FILE_THUMBNAIL;
		}
	}

	IOLocationFilter f = null;
	if (list instanceof IOLocationTileList) {
		IOLocationTileList t = (IOLocationTileList) list;
		f = t.getFilter();
	}
	boolean enabled = f == null ? true : f.filter(l) != null;
	JLabel label = getThumbnail();
	label.setEnabled(enabled);
	label.setText(text);
	label.setIcon(new ImageIcon(image));
	label.putClientProperty("selected", new Boolean(isSelected));

	format(l, label);

	return label;
}
 
源代码13 项目: aurous-app   文件: PlayerFunctions.java
public static void handleSpecialLabels(final boolean isRepeat) {
	final JLabel repeatStatusLabel = ControlPanel.repeat();
	final JLabel shuffleStatusLabel = ControlPanel.shuffle();
	if (isRepeat) {
		if (repeatStatusLabel.isEnabled()) {
			if (repeat == true) {
				repeat = false;
				repeatStatusLabel.setText("Repeat : Off");
				shuffleStatusLabel.setEnabled(true);

			} else {
				repeat = true;
				shuffle = false;
				shuffleStatusLabel.setEnabled(false);
				repeatStatusLabel.setText("Repeat : On");
				shuffleStatusLabel.setText("Shuffle : Off");
			}
		}
	} else {
		if (shuffleStatusLabel.isEnabled()) {
			if (shuffle == true) {
				shuffle = false;
				shuffleStatusLabel.setText("Shuffle : Off");
				repeatStatusLabel.setEnabled(true);

			} else {
				shuffle = true;
				repeat = false;
				repeatStatusLabel.setEnabled(false);
				shuffleStatusLabel.setText("Shuffle : On");
				repeatStatusLabel.setText("Repeat : Off");
			}
		}
	}
}
 
源代码14 项目: netbeans   文件: NotificationCenterTopComponent.java
private void init() {
        initComponents();
        detailsPanel = new JPanel(new GridLayout(1, 1));
        Color color = Utils.getTextBackground();
        detailsPanel.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue()));
        lblEmptyDetails = new JLabel(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_EmptyDetails"), JLabel.CENTER);
        lblEmptyDetails.setFont(italicFont);
        lblEmptyDetails.setEnabled(false);

        JScrollPane scrollPane = new JScrollPane(detailsPanel);
        splitPane.setRightComponent(scrollPane);

        toolBar.setFocusable(false);
        toolBar.setFloatable(false);
        btnSearch = new JToggleButton(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find16.png", true));
        btnSearch.setToolTipText(NbBundle.getMessage(NotificationCenterTopComponent.class, "LBL_SearchToolTip"));
        btnSearch.setFocusable(false);
        btnSearch.setSelected(NotificationSettings.isSearchVisible());
        //TODO delete 2 lines then quick search API clear text correctly
//        btnSearch.setToolTipText("Disabled due to Quick Search API defects");
//        btnSearch.setEnabled(false);
        btnSearch.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSearchVisible(btnSearch.isSelected());
            }
        });
        toolBar.add(btnSearch);
        toolBar.add(new FiltersMenuButton(notificationManager.getActiveFilter()));

        initLeft();
        showDetails();
    }
 
源代码15 项目: visualvm   文件: PackagesView.java
private JComponent createComponents() {
    JPanel panel = new JPanel(new BorderLayout()) {
        public void setEnabled(boolean enabled) {
            Component[] components = getComponents();
            for (Component c : components) c.setEnabled(enabled);
        }
    };
    panel.setOpaque(false);

    JLabel waitLabel = new JLabel("Loading probes...", SwingConstants.CENTER);
    waitLabel.setEnabled(false);
    panel.add(waitLabel, BorderLayout.CENTER);
    
    return panel;
}
 
源代码16 项目: netbeans   文件: BrowserMenu.java
private void fillContent( JPanel contentPanel ) {
    contentPanel.setLayout( new GridBagLayout() );

    WebBrowser activeBrowser = selectedBrowser;
    ArrayList<ListItemImpl> defaultItems = new ArrayList<>( browsers.size() );
    ArrayList<ListItemImpl> mobileItems = new ArrayList<>( browsers.size() );
    ArrayList<ListItemImpl> phoneGapItems = new ArrayList<>( browsers.size() );
    ListItem selItem = null;
    for( WebBrowser browser : browsers ) {
        ListItemImpl item = new ListItemImpl( browser );
        if( null != activeBrowser && activeBrowser.getId().equals( browser.getId() ) ) {
            selItem = item;
        }
        if( BrowserFamilyId.PHONEGAP.equals( browser.getBrowserFamily() ) ) {
            phoneGapItems.add( item );
        } else if( browser.getBrowserFamily().isMobile() ) {
            mobileItems.add( item );
        } else {
            defaultItems.add( item );
        }
    }

    addSection( contentPanel, defaultItems, NbBundle.getMessage(BrowserMenu.class, "Header_BROWSER"), 0, null, mobileItems.isEmpty() && phoneGapItems.isEmpty() );
    addSection( contentPanel, mobileItems, NbBundle.getMessage(BrowserMenu.class, "Header_MOBILE"), 2, null, phoneGapItems.isEmpty() );
    addSection( contentPanel, phoneGapItems, NbBundle.getMessage(BrowserMenu.class, "Header_PHONEGAP"), 4, createConfigureButton(), true );

    JPanel panel = createBrighterPanel();
    JLabel label = createLabel( NbBundle.getMessage(BrowserMenu.class, "Hint_NB_Connector"));
    Color lightForeground = UIManager.getColor( "Nb.browser.picker.foreground.light" ); //NOI18N
    if( null != lightForeground )
        label.setForeground( lightForeground );
    if( windowsLaF ) {
        label.setEnabled( false );
        panel.setBorder( BorderFactory.createMatteBorder( 1, 0, 0, 0, windowsSeparatorColor));
    }
    label.setBorder( BorderFactory.createEmptyBorder( 16, 17, 5, 5));
    panel.add( label, BorderLayout.WEST );

    contentPanel.add( panel, new GridBagConstraints( 0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0, 0 ));

    if( !defaultItems.isEmpty() && !mobileItems.isEmpty() && !windowsLaF ) {
        contentPanel.add( new JSeparator(JSeparator.VERTICAL),
                new GridBagConstraints( 1, 1, 1, 3, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0 ));
    }

    if( !mobileItems.isEmpty() && !phoneGapItems.isEmpty() && !windowsLaF ) {
        contentPanel.add( new JSeparator(JSeparator.VERTICAL),
                new GridBagConstraints( 3, 1, 1, 3, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0 ));
    }

    if( !phoneGapItems.isEmpty() ) {
        contentPanel.add( createLabel( NbBundle.getMessage(BrowserMenu.class, "Hint_PhoneGap")),
                new GridBagConstraints( 0, 4, GridBagConstraints.REMAINDER, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10,17,10,10), 0, 0 ));
    }

    if( null != selItem )
        selModel.setSelectedItem( selItem );
    selModel.addChangeListener( this );
}
 
源代码17 项目: triplea   文件: UserActionPanel.java
private JPanel getUserActionButtonPanel(final JDialog parent) {
  final JPanel userActionButtonPanel = new JPanel();
  userActionButtonPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
  userActionButtonPanel.setLayout(new GridBagLayout());

  final int firstRow = 0;
  final int lastRow = validUserActions.size() - 1;
  int row = 0;
  for (final UserActionAttachment uaa : validUserActions) {
    final int topInset = (row == firstRow) ? 0 : 4;
    final int bottomInset = (row == lastRow) ? 0 : 4;
    final boolean canPlayerAffordUserAction = canPlayerAffordUserAction(getCurrentPlayer(), uaa);

    userActionButtonPanel.add(
        getOtherPlayerFlags(uaa),
        new GridBagConstraints(
            0,
            row,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(topInset, 0, bottomInset, 4),
            0,
            0));

    final JButton button =
        getMap()
            .getUiContext()
            .getResourceImageFactory()
            .getResourcesButton(
                new ResourceCollection(getData(), uaa.getCostResources()),
                UserActionText.getInstance().getButtonText(uaa.getText()));
    button.addActionListener(
        ae -> {
          selectUserActionButton.setEnabled(false);
          doneButton.setEnabled(false);
          validUserActions = List.of();
          choice = uaa;
          parent.setVisible(false);
          release();
        });
    button.setEnabled(canPlayerAffordUserAction);
    userActionButtonPanel.add(
        button,
        new GridBagConstraints(
            1,
            row,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(topInset, 4, bottomInset, 4),
            0,
            0));

    final JLabel descriptionLabel = getActionDescriptionLabel(uaa);
    descriptionLabel.setEnabled(canPlayerAffordUserAction);
    userActionButtonPanel.add(
        descriptionLabel,
        new GridBagConstraints(
            2,
            row,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(topInset, 4, bottomInset, 0),
            0,
            0));

    row++;
  }

  return userActionButtonPanel;
}
 
源代码18 项目: visualvm   文件: DetailsPanel.java
private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}
 
public Main_BottomToolbar() {

        toolBar = new JToolBar();
        toolBar.setAlignmentX(Component.LEFT_ALIGNMENT);
        toolBar.setAlignmentY(Component.BOTTOM_ALIGNMENT);
        toolBar.setPreferredSize(new Dimension(1200, 25));
        toolBar.setMinimumSize(new Dimension(800, 25));
        toolBar.setAutoscrolls(true);
        toolBar.setFloatable(false);
        toolBar.setRollover(true);

        userIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_user.png")));
        toolBar.add(userIconLabel);

        //initialize weather api for use.
        liveWeather = new GetLiveWeather();
        
        userLabel = new JLabel();
        userLabel.setMaximumSize(new Dimension(160, 19));
        userLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        userLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        userLabel.setHorizontalAlignment(SwingConstants.LEFT);
        toolBar.add(userLabel);
        toolBar.addSeparator();

        dateIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_calendar.png")));
        toolBar.add(dateIconLabel);

        dateLabel = new JLabel("");
        dateLabel.setMaximumSize(new Dimension(160, 19));
        dateLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        dateLabel.setHorizontalAlignment(SwingConstants.LEFT);
        dateLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(dateLabel);
        toolBar.addSeparator();

        currencyUsdIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency.png")));
        toolBar.add(currencyUsdIcon);

        currencyUsdLabel = new JLabel("");
        currencyUsdLabel.setMaximumSize(new Dimension(160, 19));
        currencyUsdLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyUsdLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyUsdLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyUsdLabel);
        toolBar.addSeparator();

        currencyEuroIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_euro.png")));
        toolBar.add(currencyEuroIcon);

        currencyEuroLabel = new JLabel("");
        currencyEuroLabel.setMaximumSize(new Dimension(160, 19));
        currencyEuroLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyEuroLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyEuroLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyEuroLabel);
        toolBar.addSeparator();

        currencyPoundIcon = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/main_currency_pound.png")));
        toolBar.add(currencyPoundIcon);

        currencyPoundLabel = new JLabel("");
        currencyPoundLabel.setMaximumSize(new Dimension(160, 19));
        currencyPoundLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        currencyPoundLabel.setHorizontalAlignment(SwingConstants.LEFT);
        currencyPoundLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(currencyPoundLabel);
        toolBar.addSeparator();

        hotelIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/login_hotel.png")));
        toolBar.add(hotelIconLabel);

        hotelNameLabel = new JLabel("");
        hotelNameLabel.setMaximumSize(new Dimension(160, 19));
        hotelNameLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        hotelNameLabel.setHorizontalAlignment(SwingConstants.LEFT);
        hotelNameLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        toolBar.add(hotelNameLabel);
        toolBar.addSeparator();

        checkBox = new JCheckBox("");
        checkBox.setToolTipText("Enable local weather");
        checkBox.addItemListener(showWeather());
        toolBar.add(checkBox);

        weatherIconLabel = new JLabel(new ImageIcon(getClass().getResource("/com/coder/hms/icons/toolbar_weather.png")));
        toolBar.add(weatherIconLabel);

        weatherLabel = new JLabel("");
        weatherLabel.setPreferredSize(new Dimension(160, 19));
        weatherLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        weatherLabel.setHorizontalAlignment(SwingConstants.LEFT);
        weatherLabel.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 13));
        weatherLabel.setEnabled(false);
        toolBar.add(weatherLabel);

    }
 
源代码20 项目: visualvm   文件: DetailsPanel.java
private void initComponents() {        
    table = new DetailsTable();
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JViewport viewport = new Viewport(table);

    final JScrollPane tableScroll = new JScrollPane(
                                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tableScroll.setViewport(viewport);
    tableScroll.setBorder(BorderFactory.createEmptyBorder());
    tableScroll.setViewportBorder(BorderFactory.createEmptyBorder());
    tableScroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new HeaderPanel());
    
    scrollBar = new ScrollBar(JScrollBar.VERTICAL) {
        public int getUnitIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableUnitIncrement(vr, getOrientation(), direction);
        }
        public int getBlockIncrement(int direction) {
            JViewport vp = tableScroll.getViewport();
            Scrollable view = (Scrollable)(vp.getView());
            Rectangle vr = vp.getViewRect();
            return view.getScrollableBlockIncrement(vr, getOrientation(), direction);
        }
        public void setValues(int newValue, int newExtent, int newMin, int newMax) {
            setEnabled(newExtent < newMax);
            if (isEnabled() && !isSelectionChanging() && isTrackingEnd())
                newValue = newMax - newExtent;
            super.setValues(newValue, newExtent, newMin, newMax);
        }
    };
    tableScroll.setVerticalScrollBar(scrollBar);
    dataContainer = tableScroll;

    JLabel noDataLabel = new JLabel("<No probe selected>", JLabel.CENTER);
    noDataLabel.setEnabled(false);
    noDataContainer = new JPanel(new BorderLayout());
    noDataContainer.setOpaque(false);
    noDataContainer.add(noDataLabel, BorderLayout.CENTER);

    setOpaque(false);
    setLayout(new BorderLayout());
    add(noDataContainer, BorderLayout.CENTER);
}