Java Code Examples for javax.swing.JLabel.setEnabled()

The following are Jave code examples for showing how to use setEnabled() of the javax.swing.JLabel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: ConfigFilesUIs.java   View Source Code Vote up 7 votes
@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;
}
 
Example 2
Project: incubator-netbeans   File: TableUISupport.java   View Source Code Vote up 6 votes
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;
}
 
Example 3
Project: incubator-netbeans   File: Utils.java   View Source Code Vote up 6 votes
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;
}
 
Example 4
Project: incubator-netbeans   File: RefactoringPanelContainer.java   View Source Code Vote up 6 votes
/** Creates new form RefactoringPanelContainer */
private RefactoringPanelContainer(String name, boolean isRefactoring) {
    setName(name);
    setToolTipText(name);
    setFocusable(true);
    setLayout(new java.awt.BorderLayout());
    setMinimumSize(new Dimension(1,1));
    getAccessibleContext().setAccessibleDescription(
        NbBundle.getMessage(RefactoringPanelContainer.class, "ACSD_usagesPanel")
    );
    pop = new JPopupMenu();
    pop.add(new Close());
    pop.add(new CloseAll());
    pop.add(new CloseAllButCurrent());
    listener = new PopupListener();
    closeL = new CloseListener();
    this.isRefactoring = isRefactoring;
    setFocusCycleRoot(true);
    JLabel label = new JLabel(NbBundle.getMessage(RefactoringPanelContainer.class, "LBL_NoUsages"));
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setEnabled(false);
    this.add(label, BorderLayout.CENTER);
    initActions();
}
 
Example 5
Project: AWGW   File: MenuMaker.java   View Source Code Vote up 6 votes
/**
 * Constructs a property sheet that shows the editable properties of a given
 * object.
 *
 * @param object the object whose properties are being edited
 */
public PropertySheet(Class[] types, Object[] values) {
    this.values = values;
    editors = new PropertyEditor[types.length];
    setLayout(new FormLayout());
    for (int i = 0; i < values.length; i++) {
        JLabel label = new JLabel(types[i].getName());
        add(label);
        if (Grid.class.isAssignableFrom(types[i])) {
            label.setEnabled(false);
            add(new JPanel());
        } else {
            editors[i] = getEditor(types[i]);
            if (editors[i] != null) {
                editors[i].setValue(values[i]);
                add(getEditorComponent(editors[i]));
            } else
                add(new JLabel("?"));
        }
    }
}
 
Example 6
Project: incubator-netbeans   File: LiveFlatProfilePanel.java   View Source Code Vote up 6 votes
private void initComponents() {
    setLayout(new BorderLayout());

    noResultsPanel = new JPanel();
    noResultsPanel.setLayout(new BorderLayout());
    noResultsPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));

    final JLabel noResultsLabel = new JLabel(NO_RESULTS_STRING);

    noResultsLabel.setFont(noResultsLabel.getFont().deriveFont(14));
    noResultsLabel.setEnabled(false);
    noResultsPanel.add(noResultsLabel, BorderLayout.NORTH);

    resultsTable = new JPanel(new CardLayout());
    resultsTable.add(noResultsLabel, "NORESULTS"); // NOI18N

    add(resultsTable, BorderLayout.CENTER);
}
 
Example 7
Project: Equella   File: RawHtmlEditor.java   View Source Code Vote up 6 votes
protected void createBottom()
{
	userHelp = new JLabel(CurrentLocale.get(
		"com.dytech.edge.admin.wizard.editor.rawhtmleditor.select", "\"{/xpath/to/my/data}\"")); //$NON-NLS-1$ //$NON-NLS-2$
	userRadio = new JRadioButton(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.rawhtmleditor.userdefined")); //$NON-NLS-1$
	userText = new I18nTextArea(BundleCache.getLanguages());

	Dimension d = new Dimension(0, 300);
	userText.setMinimumSize(d);
	userText.setPreferredSize(d);

	userText.setEnabled(false);
	userText.setEnabled(false);
	userHelp.setEnabled(false);
	userRadio.addActionListener(new RawHtmlEditor.RadioHandler(true));

	userPanel = new JPanel(new BorderLayout(5, 5));

	userPanel.add(userRadio, BorderLayout.NORTH);
	userPanel.add(userText, BorderLayout.CENTER);
	userPanel.add(userHelp, BorderLayout.SOUTH);
}
 
Example 8
Project: incubator-netbeans   File: NotificationCenterTopComponent.java   View Source Code Vote up 5 votes
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();
    }
 
Example 9
Project: VASSAL-src   File: MassPieceLoader.java   View Source Code Vote up 5 votes
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  JLabel renderedLabel = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final BasicNode node = (BasicNode) tree.getPathForRow(row).getLastPathComponent();
  renderedLabel.setHorizontalAlignment(SwingConstants.CENTER);
  renderedLabel.setEnabled(!node.isSkip());
  renderedLabel.setForeground(EDITABLE_COLOR);
  return renderedLabel;
}
 
Example 10
Project: incubator-netbeans   File: GoToPanelImpl.java   View Source Code Vote up 5 votes
/** Creates new form GoToPanel */
public GoToPanelImpl( ContentProvider contentProvider ) throws IOException {
    this.contentProvider = contentProvider;
    initComponents();
    containsScrollPane = true;
    ((AbstractDocument)nameField.getDocument()).setDocumentFilter(UiUtils.newUserInputFilter());
    matchesList.setSelectionMode( ListSelectionModel.SINGLE_SELECTION );
    matchesList.addListSelectionListener(null);

    Color bgColorBrighter = new Color(
                                Math.min(getBackground().getRed() + BRIGHTER_COLOR_COMPONENT, 255),
                                Math.min(getBackground().getGreen() + BRIGHTER_COLOR_COMPONENT, 255),
                                Math.min(getBackground().getBlue() + BRIGHTER_COLOR_COMPONENT, 255)
                        );

    messageLabel = new JLabel();
    messageLabel.setBackground(bgColorBrighter);
    messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
    messageLabel.setEnabled(true);
    messageLabel.setText(NbBundle.getMessage(GoToPanelImpl.class, "TXT_NoSymbolsFound")); // NOI18N
    messageLabel.setFont(matchesList.getFont());

    // matchesList.setBackground( bgColorBrighter );
    // matchesScrollPane1.setBackground( bgColorBrighter );
    matchesList.setCellRenderer(
            contentProvider.getListCellRenderer(
            matchesList,
            caseSensitive.getModel()));
    contentProvider.setListModel( this, null );

    PatternListener pl = new PatternListener( this );
    nameField.getDocument().addDocumentListener(pl);
    matchesList.addListSelectionListener(pl);
    caseSensitive.setSelected(UiOptions.GoToSymbolDialog.getCaseSensitive());
    caseSensitive.addItemListener(pl);

    searchHistory = new SearchHistory(GoToPanelImpl.class, nameField);
}
 
Example 11
Project: FreeCol   File: ReportCompactColonyPanel.java   View Source Code Vote up 5 votes
/**
 * Display the header area for the concise panel.
 *
 * @param market A {@code Market} to check goods arrears
 *     status with.
 */
private void conciseHeaders(Market market) {
    reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
                    "newline, span, growx");

    reportPanel.add(newLabel("report.colony.name.header", null, null,
                             stpld("report.colony.name")),
                    "newline");

    reportPanel.add(newLabel("report.colony.grow.header", null, null,
                             stpld("report.colony.grow")));
    reportPanel.add(newLabel("report.colony.explore.header", null, null,
                             stpld("report.colony.explore")));
    for (TileImprovementType ti : this.spec.getTileImprovementTypeList()) {
        if (ti.isNatural()) continue;
        String key = "report.colony.tile." + ti.getSuffix() + ".header";
        reportPanel.add(newLabel(key, null, null, stpld(key)));
    }
    for (GoodsType gt : this.goodsTypes) {
        ImageIcon icon = new ImageIcon(this.lib.getSmallIconImage(gt));
        JLabel l = newLabel(null, icon, null,
                            stpl("report.colony.production.header")
                                .addNamed("%goods%", gt));
        l.setEnabled(market == null || market.getArrears(gt) <= 0);
        reportPanel.add(l);
    }

    final UnitType type = spec.getDefaultUnitType(getMyPlayer());
    ImageIcon colonistIcon
        = new ImageIcon(this.lib.getTinyUnitImage(type, false));
    reportPanel.add(newLabel(null, colonistIcon, null,
                             stpld("report.colony.birth")));
    reportPanel.add(newLabel("report.colony.making.header", null, null,
                             stpld("report.colony.making")));
    reportPanel.add(newLabel("report.colony.improve.header", null, null,
                             stpld("report.colony.improve")));

    reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
                    "newline, span, growx");
}
 
Example 12
Project: Neukoelln_SER316   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
      
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();

if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
          label.setBackground(new Color(212, 246, 246));
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		label.setBackground(new Color(212, 246, 246));
		return label;
	}
      }		


label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 128)));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(new Color(255, 0, 0));
      }
else { 		
	label.setForeground(Color.BLACK);
}

// set background color
if (currentPanel == null)
	label.setBackground(Color.WHITE);

else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground(new Color(212, 246, 246));

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(new Color(212, 246, 246));

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(new Color(212, 246, 246));

else if(!isSelected)
	label.setBackground(Color.WHITE);
		
// always display NREvents
if (EventsManager.isNREventsForDate(d))
	label.setIcon(evIcon);
else
	label.setIcon(null);

      return label;
  }
 
Example 13
Project: SER316-Dresden   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
/**
   * Based on panel selected show markings and content related to its 
   * duration in the calendar.
   */
  public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
  	
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();
if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
          label.setBackground(ColorMap.NULLDAY);
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		label.setBackground(ColorMap.NOPROJECT);
		return label;
	}
      }



label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(ColorMap.TODAY));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(ColorMap.SUNDAYTEXT);
      }
else { 		
	label.setForeground(ColorMap.DAYTEXT);
}

// set background color
if (currentPanel == null)
	label.setBackground(ColorMap.FREEBG);

else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground(ColorMap.TASKBG);

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(ColorMap.NOTEBG);

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(ColorMap.EVENTBG);

else if(!isSelected)
	label.setBackground(ColorMap.FREEBG);
else {
	label.setBackground(ColorMap.DAYSELECT);
}
// always display NREvents
if (EventsManager.isNonRepeatingEventsForDate(d))
	label.setIcon(IconFontSwing.buildIcon(GoogleMaterialDesignIcons.PRIORITY_HIGH, 24, ColorMap.PRIORITY));
else
	label.setIcon(null);

      return label;
  }
 
Example 14
Project: Reinickendorf_SER316   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
      
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();

if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
	PreferencesDialog.setJComponentBGandFG(label);
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		PreferencesDialog.setJComponentBGandFG(label);
		return label;
	}
      }		


label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 128)));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(new Color(255, 0, 0));
      }
else { 		
	label.setForeground(Color.BLACK);
}

// set background color
if (currentPanel == null)
	PreferencesDialog.setJComponentBGandFG(label);
else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground( new Color(230, 255, 230));

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(new Color(255,245,200));

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(new Color(255,230,230));

else if(!isSelected)
	PreferencesDialog.setJComponentBGandFG(label);
		
// always display NREvents
if (EventsManager.isNREventsForDate(d))
	label.setIcon(evIcon);
else
	label.setIcon(null);

      return label;
  }
 
Example 15
Project: incubator-netbeans   File: HierarchyTopComponent.java   View Source Code Vote up 4 votes
@NbBundle.Messages({
    "TXT_NonActiveContent=<No View Available - Refresh Manually>",
    "TXT_InspectHierarchyHistory=<empty>",
    "TOOLTIP_RefreshContent=Refresh for entity under cursor",
    "TOOLTIP_OpenJDoc=Open Javadoc Window",
    "TOOLTIP_ViewHierarchyType=Hierachy View Type",
    "TOOLTIP_InspectHierarchyHistory=Inspect Hierarchy History"
})
public HierarchyTopComponent() {
    history = HistorySupport.getInstnace(this.getClass());
    jdocFinder = SelectJavadocTask.create(this);
    jdocTask = RP.create(jdocFinder);
    explorerManager = new ExplorerManager();
    rootChildren = new RootChildren();
    filters = new HierarchyFilters();
    explorerManager.setRootContext(Nodes.rootNode(rootChildren, filters));
    selectedNodes  = new InstanceContent();
    lookup = new AbstractLookup(selectedNodes);
    explorerManager.addPropertyChangeListener(this);
    initComponents();
    setName(Bundle.CTL_HierarchyTopComponent());
    setToolTipText(Bundle.HINT_HierarchyTopComponent());        
    viewTypeCombo = new JComboBox(new DefaultComboBoxModel(ViewType.values()));
    viewTypeCombo.setMinimumSize(new Dimension(MIN_TYPE_WIDTH,COMBO_HEIGHT));
    viewTypeCombo.addActionListener(this);
    viewTypeCombo.setToolTipText(Bundle.TOOLTIP_ViewHierarchyType());
    historyCombo = new JComboBox(HistorySupport.createModel(history, Bundle.TXT_InspectHierarchyHistory()));
    historyCombo.setMinimumSize(new Dimension(MIN_HISTORY_WIDTH,COMBO_HEIGHT));
    historyCombo.setRenderer(HistorySupport.createRenderer(history));
    historyCombo.addActionListener(this);
    historyCombo.setEnabled(false);
    historyCombo.getModel().addListDataListener(this);
    historyCombo.setToolTipText(Bundle.TOOLTIP_InspectHierarchyHistory());
    refreshButton = new JButton(ImageUtilities.loadImageIcon(REFRESH_ICON, true));
    refreshButton.addActionListener(this);
    refreshButton.setToolTipText(Bundle.TOOLTIP_RefreshContent());
    jdocButton = new JButton(ImageUtilities.loadImageIcon(JDOC_ICON, true));
    jdocButton.addActionListener(this);
    jdocButton.setToolTipText(Bundle.TOOLTIP_OpenJDoc());
    final Box upperToolBar = new MainToolBar(
        constrainedComponent(viewTypeCombo, GridBagConstraints.HORIZONTAL, 1.0, new Insets(0,0,0,0)),
        constrainedComponent(historyCombo, GridBagConstraints.HORIZONTAL, 1.5, new Insets(0,3,0,0)),
        constrainedComponent(refreshButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,0)),
        constrainedComponent(jdocButton, GridBagConstraints.NONE, 0.0, new Insets(0,3,0,3)));
    add(decorateAsUpperPanel(upperToolBar), BorderLayout.NORTH);
    contentView = new JPanel();
    contentView.setLayout(new CardLayout());
    JPanel nonActiveContent = Utils.updateBackground(new JPanel());
    nonActiveContent.setLayout(new BorderLayout());
    nonActiveInfo = new JLabel(Bundle.TXT_NonActiveContent());
    nonActiveInfo.setEnabled(false);
    nonActiveInfo.setHorizontalAlignment(SwingConstants.CENTER);
    nonActiveContent.add(nonActiveInfo, BorderLayout.CENTER);
    btw = createBeanTreeView();
    contentView.add(nonActiveContent, NON_ACTIVE_CONTENT);
    contentView.add(btw, ACTIVE_CONTENT);
    add(contentView,BorderLayout.CENTER);
    lowerToolBar = new TapPanel();
    lowerToolBar.setOrientation(TapPanel.DOWN);
    final JComponent lowerButtons = filters.getComponent();
    lowerButtons.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 0));
    lowerToolBar.add(lowerButtons);
    final boolean expanded = NbPreferences.forModule(HierarchyTopComponent.class).
            getBoolean(PROP_LOWER_TOOLBAR_EXPANDED, true); //NOI18N
    lowerToolBar.setExpanded(expanded);
    lowerToolBar.addPropertyChangeListener(this);
    add(Utils.updateBackground(lowerToolBar), BorderLayout.SOUTH);
}
 
Example 16
Project: dracoon-dropzone   File: SettingsDialog.java   View Source Code Vote up 4 votes
private JPanel createCredentialsInput() {
	// main body
	JPanel main = new JPanel();
	main.setBorder(new EmptyBorder(10, 0, 10, 0));
	main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));

	// Create and populate the panel.
	JPanel credentialsPanel = new JPanel(new SpringLayout());

	MatteBorder mb = new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY);
	TitledBorder tb = new TitledBorder(mb, I18n.get("settings.credentials"), TitledBorder.LEFT,
			TitledBorder.DEFAULT_POSITION);
	credentialsPanel.setBorder(tb);

	JLabel serverLabel = new JLabel(I18n.get("settings.server"), JLabel.TRAILING);
	credentialsPanel.add(serverLabel);
	serverInput = new JTextField();
	serverLabel.setLabelFor(serverInput);
	credentialsPanel.add(serverInput);

	JLabel authLabel = new JLabel(I18n.get("settings.authmethod"), JLabel.TRAILING);
	credentialsPanel.add(authLabel);
	authBox = new JComboBox<>();
	authLabel.setLabelFor(authBox);
	credentialsPanel.add(authBox);

	JLabel pathLabel = new JLabel(I18n.get("settings.remotepath"), JLabel.TRAILING);
	credentialsPanel.add(pathLabel);
	pathInput = new JTextField();
	pathLabel.setLabelFor(pathInput);
	credentialsPanel.add(pathInput);

	JLabel userLabel = new JLabel(I18n.get("settings.username"), JLabel.TRAILING);
	credentialsPanel.add(userLabel);
	userInput = new JTextField();
	userLabel.setLabelFor(userInput);
	credentialsPanel.add(userInput);

	JLabel pwdLabel = new JLabel(I18n.get("settings.password"), JLabel.TRAILING);
	credentialsPanel.add(pwdLabel);
	pwdInput = new JPasswordField();
	pwdLabel.setLabelFor(pwdInput);
	credentialsPanel.add(pwdInput);

	JLabel enableMasterPwdLabel = new JLabel(I18n.get("settings.usemasterpwd"), JLabel.TRAILING);
	credentialsPanel.add(enableMasterPwdLabel);
	useMasterPasswordInput = new JCheckBox();
	useMasterPasswordInput.setSelected(false);
	useMasterPasswordInput.setToolTipText(I18n.get("settings.masterpwddesc"));
	enableMasterPwdLabel.setLabelFor(useMasterPasswordInput);
	credentialsPanel.add(useMasterPasswordInput);
	useMasterPasswordInput.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			setMasterPwdInputEnabled(useMasterPasswordInput.isSelected());
		}
	});

	masterPwdLabel = new JLabel(I18n.get("settings.masterpwd"), JLabel.TRAILING);
	masterPwdLabel.setEnabled(false);
	credentialsPanel.add(masterPwdLabel);
	masterPwdInput = new JPasswordField();
	masterPwdInput.setToolTipText(I18n.get("settings.masterpwddesc"));
	masterPwdInput.setEnabled(false);
	masterPwdLabel.setLabelFor(masterPwdInput);
	credentialsPanel.add(masterPwdInput);

	// Lay out the panel.
	SwingUtil.makeCompactGrid(credentialsPanel, 7, 2, // rows, cols
			6, 6, // initX, initY
			6, 6); // xPad, yPad

	main.add(credentialsPanel);
	return main;
}
 
Example 17
Project: freecol   File: NewUnitPanel.java   View Source Code Vote up 4 votes
/**
 * Updates this panel's labels so that the information it displays
 * is up to date.
 */
public final void update() {
    removeAll();

    final Player player = getMyPlayer();
    final Europe europe = player.getEurope();

    add(question, "span, wrap 20");

    // The prices may have changed, recreate the buttons
    buttons.clear();
    for (UnitType ut : sort(units, priceComparator)) {
        int price = europe.getUnitPrice(ut);
        boolean enable = player.checkGold(price);
        JButton newButton = new JButton();
        newButton.setLayout(new MigLayout("wrap 2", "[60]", "[30][30]"));
        ImageIcon icon = new ImageIcon(getImageLibrary().getSmallUnitImage(
            ut, !enable));
        JLabel name = Utility.localizedLabel(ut);
        name.setEnabled(enable);
        JLabel gold = Utility.localizedLabel(StringTemplate
            .template("goldAmount")
            .addAmount("%amount%", price));
        gold.setEnabled(enable);
        newButton.setEnabled(enable);
        newButton.add(new JLabel(icon), "span 1 2");
        newButton.add(name);
        newButton.add(gold);
        newButton.setActionCommand(ut.getId());
        newButton.addActionListener(this);
        buttons.add(newButton);
        add(newButton, "grow");
    }

    add(okButton, "newline 20, span, tag ok");

    setSize(getPreferredSize());
    revalidate();

    shouldEnable = player.checkGold(europe.getUnitPrice(first(units)));
}
 
Example 18
Project: incubator-netbeans   File: ImportClassPanel.java   View Source Code Vote up 4 votes
/** Creates new form ImportClassPanel */
   public ImportClassPanel(List<TypeElement> priviledged, List<TypeElement> denied, Font font, JavaSource javaSource, int position, JTextComponent target ) {
       // System.err.println("priviledged=" + priviledged);
       // System.err.println("denied=" + denied);
       this.javaSource = javaSource;
       this.position = position;
       this.target = target;
       createModel(priviledged, denied);
       initComponents();
       setBackground(jList1.getBackground());
       
       if ( model.size() > 0) {
           jList1.setModel( model );
           setFocusable(false);        
           setNextFocusableComponent(jList1);
           jScrollPane1.setBackground( jList1.getBackground() );
           setBackground( jList1.getBackground() );
           if ( font != null ) {
               jList1.setFont(font);
           }
           int modelSize = jList1.getModel().getSize();
           if ( modelSize > 0 ) {
               jList1.setSelectedIndex(0);            
           }
           jList1.setVisibleRowCount( modelSize > 8 ? 8 : modelSize );
           jList1.setCellRenderer( new Renderer( jList1 ) );
           jList1.grabFocus();
       }
       else {            
           remove( jScrollPane1 );
           JLabel nothingFoundJL = new JLabel("<No Classes Found>");
           if ( font != null ) {
               nothingFoundJL.setFont(font);
           }
           nothingFoundJL.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 4, 4, 4));
           nothingFoundJL.setEnabled(false);
           nothingFoundJL.setBackground(jList1.getBackground());
           //nothingFoundJL.setOpaque(true);
           add( nothingFoundJL );
       }

setA11Y();
   }
 
Example 19
Project: SER316-Ingolstadt   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
      
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();

if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
          label.setBackground(new Color(0xE0,0xE0,0xE0));
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		label.setBackground(new Color(0xF0,0xF0,0xF0));
		return label;
	}
      }		


label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 128)));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(new Color(255, 0, 0));
      }
else { 		
	label.setForeground(Color.BLACK);
}

// set background color
if (currentPanel == null)
	label.setBackground(Color.WHITE);

else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground( new Color(230, 255, 230));

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(new Color(255,245,200));

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(new Color(255,230,230));

else if(!isSelected)
	label.setBackground(Color.WHITE);
		
// always display NREvents
if (EventsManager.isNREventsForDate(d))
	label.setIcon(evIcon);
else
	label.setIcon(null);

      return label;
  }
 
Example 20
Project: incubator-netbeans   File: BrowserMenu.java   View Source Code Vote up 4 votes
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 );
}