Java Code Examples for com.alee.laf.label.WebLabel#setForeground()
The following examples show how to use
com.alee.laf.label.WebLabel#setForeground() .
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: ContactListView.java From desktopclient-java with GNU General Public License v3.0 | 6 votes |
FlyweightContactItem() { //this.setPaintFocus(true); this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0)); this.setMargin(View.MARGIN_SMALL); mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE); this.add(mAvatar, BorderLayout.WEST); mNameLabel = new WebLabel(); mNameLabel.setFontSize(View.FONT_SIZE_BIG); mNameLabel.setDrawShade(true); mStatusLabel = new WebLabel(); mStatusLabel.setForeground(Color.GRAY); mStatusLabel.setFontSize(View.FONT_SIZE_TINY); this.add( new GroupPanel(View.GAP_SMALL, false, mNameLabel, new GroupPanel(GroupingType.fillFirst, Box.createGlue(), mStatusLabel) ), BorderLayout.CENTER); }
Example 2
Source File: ComponentUtils.java From desktopclient-java with GNU General Public License v3.0 | 5 votes |
CellRenderer() { mNameLabel = new WebLabel(); mRoleLabel = new WebLabel(); mRoleLabel.setForeground(View.DARK_GREEN); this.setMargin(View.MARGIN_DEFAULT); this.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); this.add(new GroupPanel(GroupingType.fillMiddle, View.GAP_DEFAULT, mNameLabel, Box.createGlue(), mRoleLabel), BorderLayout.CENTER); }
Example 3
Source File: ChatListView.java From desktopclient-java with GNU General Public License v3.0 | 5 votes |
FlyweightChatItem() { this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0)); this.setMargin(View.MARGIN_DEFAULT); mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE); this.add(mAvatar, BorderLayout.WEST); mTitleLabel = new WebLabel(); mTitleLabel.setFontSize(View.FONT_SIZE_BIG); mTitleLabel.setDrawShade(true); mStatusLabel = new WebLabel(); mStatusLabel.setForeground(Color.GRAY); mStatusLabel.setFontSize(View.FONT_SIZE_TINY); this.add(mStatusLabel, BorderLayout.EAST); mChatStateLabel = new WebLabel(); mChatStateLabel.setForeground(View.DARK_RED); mChatStateLabel.setFontSize(View.FONT_SIZE_TINY); mChatStateLabel.setBoldFont(); //mChatStateLabel.setMargin(0, 5, 0, 5); this.add( new GroupPanel(View.GAP_SMALL, false, mTitleLabel, new GroupPanel(GroupingType.fillFirst, Box.createGlue(), mStatusLabel, mChatStateLabel) ), BorderLayout.CENTER); }
Example 4
Source File: View.java From desktopclient-java with GNU General Public License v3.0 | 5 votes |
void showPasswordDialog(boolean wasWrong) { WebPanel passPanel = new WebPanel(); WebLabel passLabel = new WebLabel(Tr.tr("Please enter your key password:")); passPanel.add(passLabel, BorderLayout.NORTH); final WebPasswordField passField = new WebPasswordField(); passPanel.add(passField, BorderLayout.CENTER); if (wasWrong) { WebLabel wrongLabel = new WebLabel(Tr.tr("Wrong password")); wrongLabel.setForeground(Color.RED); passPanel.add(wrongLabel, BorderLayout.SOUTH); } WebOptionPane passPane = new WebOptionPane(passPanel, WebOptionPane.QUESTION_MESSAGE, WebOptionPane.OK_CANCEL_OPTION); JDialog dialog = passPane.createDialog(mMainFrame, Tr.tr("Enter password")); dialog.setModal(true); dialog.addWindowFocusListener(new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { passField.requestFocusInWindow(); } }); // blocking LOGGER.info("asking for password…"); dialog.setVisible(true); Object value = passPane.getValue(); if (value != null && value.equals(WebOptionPane.OK_OPTION)) mControl.connect(passField.getPassword()); }
Example 5
Source File: TabPanelMaintenance.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor. * * @param malfunction the malfunction for the panel. * @param building the building the malfunction is in. */ public BuildingMalfunctionPanel(Malfunction malfunction, Building building) { // Use WebPanel constructor super(); // Initialize data members this.malfunction = malfunction; // Set layout and border. setLayout(new GridLayout(5, 1, 0, 0)); // setBorder(new MarsPanelBorder()); // Prepare the building label. WebLabel buildingLabel = new WebLabel(building.getNickName(), WebLabel.LEFT); buildingLabel.setFont(new Font("Serif", Font.BOLD, 14)); add(buildingLabel); // Prepare the malfunction label. malfunctionLabel = new WebLabel(malfunction.getName(), WebLabel.LEFT); malfunctionLabel.setForeground(Color.red); add(malfunctionLabel); workLabel = new WebLabel("", WebLabel.LEFT); // workLabel.setFont(new Font("Serif", Font.ITALIC, 12)); // workLabel.setForeground(Color.LIGHT_GRAY); // workLabel.setBackground(Color.DARK_GRAY); add(workLabel); // Progress bar panel. WebPanel progressBarPanel = new WebPanel(new BorderLayout(0, 0)); add(progressBarPanel, BorderLayout.CENTER); // Prepare progress bar. JProgressBar progressBar = new JProgressBar(); progressBarModel = progressBar.getModel(); progressBar.setStringPainted(true); progressBarPanel.add(progressBar, BorderLayout.CENTER); // Set initial value for repair progress bar. progressBarModel.setValue(0); // Prepare parts label. partsLabel = new WebLabel(getPartsString(malfunction.getRepairParts(), false), WebLabel.CENTER); partsLabel.setPreferredSize(new Dimension(-1, -1)); add(partsLabel); // Add tooltip. // setToolTipText(getToolTipString()); TooltipManager.setTooltip(this, getToolTipString(), TooltipWay.up); update(); }
Example 6
Source File: MalfunctionPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructs a MalfunctionPanel object with a name prefix. * @param malfunction the malfunction to display */ public MalfunctionPanel(Malfunction malfunction) { // Call JPanel constructor. super(); // Initialize data members. this.malfunction = malfunction; // Set layout setLayout(new GridLayout(3, 1, 0, 0)); // Set border setBorder(new MarsPanelBorder()); setOpaque(false); setBackground(new Color(0,0,0,128)); // Prepare name label. nameLabel = new WebLabel(malfunction.getName(), WebLabel.CENTER); if (!malfunction.isEmergencyRepairDone()) { nameLabel.setText(malfunction.getName() + " - Emergency"); nameLabel.setForeground(Color.red); } add(nameLabel); // Prepare repair pane. WebPanel repairPane = new WebPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); add(repairPane); // Prepare repair progress bar. WebProgressBar repairBar = new WebProgressBar(); repairBarModel = repairBar.getModel(); repairBar.setStringPainted(true); repairPane.add(repairBar); // Set initial value for repair progress bar. // double totalRequiredWork = malfunction.getEmergencyWorkTime() + malfunction.getGeneralWorkTime() // + malfunction.getEVAWorkTime(); // double totalCompletedWork = malfunction.getCompletedEmergencyWorkTime() + // malfunction.getCompletedGeneralWorkTime() + malfunction.getCompletedEVAWorkTime(); // int percentComplete = 0; // if (totalRequiredWork > 0D) percentComplete = (int) (100D * (totalCompletedWork / totalRequiredWork)); repairBarModel.setValue((int)malfunction.getPercentageFixed()); // Prepare repair parts label. partsLabel = new WebLabel(getPartsString(), WebLabel.CENTER); partsLabel.setPreferredSize(new Dimension(-1, -1)); add(partsLabel); // Add tooltip. setToolTipText(getToolTipString()); }
Example 7
Source File: Notifier.java From desktopclient-java with GNU General Public License v3.0 | 4 votes |
private void showNotification() { final WebDialog dialog = new WebDialog(); dialog.setUndecorated(true); dialog.setBackground(Color.BLACK); dialog.setBackground(StyleConstants.transparent); WebNotificationPopup popup = new WebNotificationPopup(PopupStyle.dark); popup.setIcon(Utils.getIcon("kontalk_small.png")); popup.setMargin(View.MARGIN_DEFAULT); popup.setDisplayTime(6000); popup.addNotificationListener(new NotificationListener() { @Override public void optionSelected(NotificationOption option) { } @Override public void accepted() { } @Override public void closed() { dialog.dispose(); } }); // content WebPanel panel = new WebPanel(); panel.setMargin(View.MARGIN_DEFAULT); panel.setOpaque(false); WebLabel title = new WebLabel("A new Message!"); title.setFontSize(View.FONT_SIZE_BIG); title.setForeground(Color.WHITE); panel.add(title, BorderLayout.NORTH); String text = "this is some message, and some longer text was added"; WebLabel message = new WebLabel(text); message.setForeground(Color.WHITE); panel.add(message, BorderLayout.CENTER); popup.setContent(panel); //popup.packPopup(); dialog.setSize(popup.getPreferredSize()); // set position on screen GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); Rectangle screenBounds = gc.getBounds(); // get height of the task bar // doesn't work on all environments //Insets toolHeight = toolkit.getScreenInsets(popup.getGraphicsConfiguration()); int toolHeight = 40; dialog.setLocation(screenBounds.width - dialog.getWidth() - 10, screenBounds.height - toolHeight - dialog.getHeight()); dialog.setVisible(true); NotificationManager.showNotification(dialog, popup); }