List of usage examples for java.awt Font ITALIC
int ITALIC
To view the source code for java.awt Font ITALIC.
Click Source Link
From source file:org.pentaho.platform.uifoundation.chart.DialWidgetDefinition.java
/** * Create a dial definition object from an XML document * /*from w w w. j a v a2 s.c o m*/ * @param doc * definition XML document * @return Dial definition object */ public static void createDial(final DialWidgetDefinition widgetDefinition, final Node dialNode, final int width, final int height, final IPentahoSession session) { Node node = dialNode.selectSingleNode("units"); //$NON-NLS-1$ if (node != null) { String units = node.getText(); widgetDefinition.setUnits(units); } // set the background Paint Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("background-color")); //$NON-NLS-1$ if (paint == null) { Element backgroundNode = (Element) dialNode.selectSingleNode("chart-background"); //$NON-NLS-1$ if (backgroundNode != null) { String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$ if ("texture".equals(backgroundType)) { //$NON-NLS-1$ paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session); } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$ paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height); } } } else { // log a deprecation warning for background-color ... DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$ "background-color", "chart-background")); //$NON-NLS-1$ //$NON-NLS-2$ DialWidgetDefinition.getLogger().warn( Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "background-color")); //$NON-NLS-1$ //$NON-NLS-2$ } if (paint != null) { widgetDefinition.setChartBackgroundPaint(paint); } // set the dial background Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("plot-background-color")); //$NON-NLS-1$ if (paint == null) { Element backgroundNode = (Element) dialNode.selectSingleNode("plot-background"); //$NON-NLS-1$ if (backgroundNode != null) { String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$ if ("texture".equals(backgroundType)) { //$NON-NLS-1$ paint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session); } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$ paint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height); } } } else { // log a deprecation warning for plot-background-color ... DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_PROPERTY", //$NON-NLS-1$ "plot-background-color", "plot-background")); //$NON-NLS-1$ //$NON-NLS-2$ DialWidgetDefinition.getLogger().warn(Messages.getInstance() .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "plot-background-color")); //$NON-NLS-1$ //$NON-NLS-2$ } if (paint != null) { widgetDefinition.setPlotBackgroundPaint(paint); } // set the needle Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("needle-color")); //$NON-NLS-1$ if (paint != null) { widgetDefinition.setNeedlePaint(paint); } // set the tick Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("tick-color")); //$NON-NLS-1$ if (paint != null) { widgetDefinition.setTickPaint(paint); } Node tmpNode = dialNode.selectSingleNode("tick-interval"); //$NON-NLS-1$ if (tmpNode != null) { widgetDefinition.setTickSize(Integer.parseInt(dialNode.selectSingleNode("tick-interval").getText())); //$NON-NLS-1$ } // set the value Paint paint = JFreeChartEngine.getPaint(dialNode.selectSingleNode("value-color")); //$NON-NLS-1$ if (paint != null) { widgetDefinition.setValuePaint(paint); } // TODO get this from the XML document widgetDefinition.setDialShape(DialShape.CHORD); Node titleFontNode = dialNode.selectSingleNode("title-font"); //$NON-NLS-1$ if (titleFontNode != null) { Node fontNode = titleFontNode.selectSingleNode("font"); //$NON-NLS-1$ if (fontNode != null) { String titleFontStr = fontNode.getText().trim(); if (!"".equals(titleFontStr)) { //$NON-NLS-1$ Node titleFontSizeNode = titleFontNode.selectSingleNode("size"); //$NON-NLS-1$ int size = titleFontSizeNode != null ? Integer.parseInt(titleFontSizeNode.getText()) : 12; widgetDefinition.setTitleFont(new Font(titleFontStr, Font.BOLD, size)); } } else { String titleFontStr = titleFontNode.getText().trim(); if (!"".equals(titleFontStr)) { //$NON-NLS-1$ widgetDefinition.setTitleFont(new Font(titleFontStr, Font.ITALIC, 24)); } } } Node valueFontNode = dialNode.selectSingleNode("domain-tick-font"); //$NON-NLS-1$ if (valueFontNode != null) { Node fontNode = valueFontNode.selectSingleNode("font"); //$NON-NLS-1$ if (fontNode != null) { String fontStr = fontNode.getText().trim(); if (!"".equals(fontStr)) { //$NON-NLS-1$ Node valueFontSizeNode = valueFontNode.selectSingleNode("size"); //$NON-NLS-1$ int size = valueFontSizeNode != null ? Integer.parseInt(valueFontSizeNode.getText()) : 12; widgetDefinition.setValueFont(new Font(fontStr, Font.BOLD, size)); } } else { String fontStr = valueFontNode.getText().trim(); if (!"".equals(fontStr)) { //$NON-NLS-1$ widgetDefinition.setValueFont(new Font(fontStr, Font.ITALIC, 24)); } } } // set any intervals that are defined in the document // A list of interval nodes should not be allowed to exist as a child of the main XML element (for XML schema // to // be well constructed and validate the XML . // We have deprecated <interval> as a child of the main node , and now require an <intervals> parent node // under which <intervals> can exist. List intervals = dialNode.selectNodes("interval"); //$NON-NLS-1$ if ((intervals == null) || (intervals.isEmpty())) { Node intervalsNode = dialNode.selectSingleNode("intervals"); //$NON-NLS-1$ if (intervalsNode != null) { intervals = intervalsNode.selectNodes("interval"); //$NON-NLS-1$ } } else { // log a deprecation warning for this property... DialWidgetDefinition.getLogger() .warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", "interval", "intervals")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ DialWidgetDefinition.getLogger() .warn(Messages.getInstance().getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", "interval")); //$NON-NLS-1$ //$NON-NLS-2$ } if (intervals != null) { Iterator intervalIterator = intervals.iterator(); while (intervalIterator.hasNext()) { // get the interval node Node intervalNode = (Node) intervalIterator.next(); // get the interval name String label = intervalNode.selectSingleNode("label").getText(); //$NON-NLS-1$ // get the range of the interval double minimum = Double.parseDouble(intervalNode.selectSingleNode("minimum").getText()); //$NON-NLS-1$ double maximum = Double.parseDouble(intervalNode.selectSingleNode("maximum").getText()); //$NON-NLS-1$ Range range = new Range(minimum, maximum); Paint backgroundPaint = JFreeChartEngine.getPaint(intervalNode.selectSingleNode("color")); //$NON-NLS-1$ if (backgroundPaint == null) { Element backgroundNode = (Element) intervalNode.selectSingleNode("interval-background"); //$NON-NLS-1$ if (backgroundNode != null) { String backgroundType = backgroundNode.attributeValue("type"); //$NON-NLS-1$ if ("texture".equals(backgroundType)) { //$NON-NLS-1$ backgroundPaint = JFreeChartEngine.getTexturePaint(backgroundNode, width, height, session); } else if ("gradient".equals(backgroundType)) { //$NON-NLS-1$ backgroundPaint = JFreeChartEngine.getGradientPaint(backgroundNode, width, height); } } } // get the text color of the interval String textColor = intervalNode.selectSingleNode("text-color").getText(); //$NON-NLS-1$ Stroke outlineStroke; if (intervalNode.selectSingleNode("stroke-width") != null) { //$NON-NLS-1$ outlineStroke = new BasicStroke( Float.parseFloat(intervalNode.selectSingleNode("stroke-width").getText())); //$NON-NLS-1$ } else { outlineStroke = new BasicStroke(); } Paint outlinePaint = JFreeChartEngine.getPaint(textColor); // create the interval object MeterInterval interval = new MeterInterval(label, range, outlinePaint, outlineStroke, backgroundPaint); // add the interval to the widget widgetDefinition.addInterval(interval); } } // get the chart subtitles // A list of <subtitle> nodes should not be allowed to exist as a child of the main XML element (for XML schema // to // be well constructed and validate the XML . // We have deprecated <subtitle> as a child of the main node , and now require a <subtitles> parent node // under which <subtitle> can exist. List subtitles = dialNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME); if ((subtitles == null) || (subtitles.isEmpty())) { Node subTitlesNode = dialNode.selectSingleNode(ChartDefinition.SUBTITLES_NODE_NAME); if (subTitlesNode != null) { subtitles = subTitlesNode.selectNodes(ChartDefinition.SUBTITLE_NODE_NAME); } } else { // log a deprecation warning for this property... DialWidgetDefinition.getLogger().warn(Messages.getInstance().getString("CHART.WARN_DEPRECATED_CHILD", //$NON-NLS-1$ ChartDefinition.SUBTITLE_NODE_NAME, ChartDefinition.SUBTITLES_NODE_NAME)); DialWidgetDefinition.getLogger().warn(Messages.getInstance() .getString("CHART.WARN_PROPERTY_WILL_NOT_VALIDATE", ChartDefinition.SUBTITLE_NODE_NAME)); //$NON-NLS-1$ } if (subtitles != null) { widgetDefinition.addSubTitles(subtitles); } }
From source file:pt.webdetails.cgg.scripts.BaseScope.java
private static int parseCssFontStyleAndWeight(String fontStyle, String fontWeight) { //Font.ITALIC //Font.BOLD/*from w w w.j a va 2 s . c o m*/ //Font.PLAIN boolean isItalic = false; boolean isBold = false; if (fontStyle != null) { fontStyle = fontStyle.toLowerCase(); if (fontStyle.equals("italic") || fontStyle.equals("oblique")) { isItalic = true; } } if (fontWeight != null) { fontWeight = fontWeight.toLowerCase(); if (fontWeight.equals("bold") || fontWeight.equals("bolder") || fontWeight.equals("700") || fontWeight.equals("800") || fontWeight.equals("900")) { isBold = true; } } if (isItalic) { return isBold ? (Font.ITALIC | Font.BOLD) : Font.ITALIC; } return isBold ? Font.BOLD : Font.PLAIN; }
From source file:pt.webdetails.cgg.scripts.BaseScope.java
private static Font decodeFont(String fontFamily, int fontStyle, int isize) { String fontStyleText = ""; switch (fontStyle) { case Font.BOLD: fontStyleText = "BOLD "; break;//from ww w . j a v a 2 s.c o m case Font.ITALIC: fontStyleText = "ITALIC "; break; case (Font.ITALIC | Font.BOLD): fontStyleText = "BOLDITALIC "; break; } String capFontFamily = fontFamily.substring(0, 1).toUpperCase() + fontFamily.substring(1, fontFamily.length()); Font ffont = Font.decode(capFontFamily + " " + fontStyleText + isize); if (ffont.getFamily().equals(Font.DIALOG) && !fontFamily.equals("dialog")) { // defaulted, try family GVTFontFamily awtFamily = FontFamilyResolver.resolve(fontFamily); if (awtFamily == null) { awtFamily = FontFamilyResolver.defaultFont; } ffont = new Font(awtFamily.getFamilyName(), fontStyle, isize); } return ffont; }
From source file:MainProgram.MainProgram.java
private void initComponents() throws InterruptedException { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents welcomeMessage = new JLabel(); welcomeMessage2 = new JLabel(); pennIDLabel = new JLabel(); pennIDTextField = new JTextField(); pennPassLabel = new JLabel(); pennPassField = new JPasswordField(); emailLabel = new JLabel(); emailTextField = new JTextField(); emailDomainLabel = new JLabel(); emailPassLabel = new JLabel(); emailPassField = new JPasswordField(); semesterLabel = new JLabel(); semesterComboBox = new JComboBox(semestersString); credentials = new JLabel(); dropLabel = new JLabel(); dropCheckBox = new JCheckBox(); button = new JButton(); stopWatchLabel = new JLabel(); checkMail = false;/*ww w . j av a 2s .c o m*/ testConnection = false; mailCheckTimeInitializer(); StopWatchInitializer(); try { setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12)); } catch (Exception e) { e.printStackTrace(MainProgram.errorLog); } String lcOSName = System.getProperty("os.name").toLowerCase(); boolean IS_MAC = lcOSName.startsWith("mac os x"); //======== this ======== setLayout(new GridBagLayout()); ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 }; if (!IS_MAC) { ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0, 0 }; } ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 }; GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.fill = GridBagConstraints.HORIZONTAL; //---- welcomeMessage ---- welcomeMessage.setText("Course Registration"); welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- welcomeMessage2 ---- welcomeMessage2.setText("for Penn State (BETA)"); welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER); add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDLabel ---- pennIDLabel.setText("Penn State ID: "); pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennIDTextField ---- pennIDTextField.setText("xxx123"); add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- pennPassLabel ---- pennPassLabel.setText("Penn State Password: "); pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailLabel ---- emailLabel.setText("Email: "); emailLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailTextField ---- emailTextField.setText("myEmail"); add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailDomainLabel ---- emailDomainLabel.setText("@mail.com"); add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- emailPassLabel ---- emailPassLabel.setText("Email Password: "); emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester label ---- semesterLabel.setText("Semester/Drop Option: "); semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT); add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Semester ComboBox ---- add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- Drop CheckBox ---- add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- button ---- button.setText("Start"); add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- stopWatchLabel ---- stopWatchLabel.setText(" " + stopWatchSplitting[0]); stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT); add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- label11 ---- credentials.setText(" Created by Daniyar Yeralin"); credentials.setForeground(Color.gray); credentials.setHorizontalAlignment(SwingConstants.RIGHT); credentials.setFont(new Font("Cambria", Font.ITALIC, 12)); add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); /*button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); button.registerKeyboardAction(button.getActionForKeyStroke( KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), JComponent.WHEN_FOCUSED);*/ StartButtonHandler buttonListener = new StartButtonHandler(); button.addActionListener(buttonListener); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** Initializes the components composing the display. */ private void initComponents() { setLayout(new BorderLayout()); setBackground(UIUtilities.BACKGROUND); setBorder(new SeparatorOneLineBorder()); toReplace = new ArrayList<FileAnnotationData>(); IconManager icons = IconManager.getInstance(); filter = SHOW_ALL;/* w ww. java2 s. c o m*/ filterButton = new JButton(NAMES[SHOW_ALL]); filterButton.setToolTipText("Filter tags and attachments."); UIUtilities.unifiedButtonLookAndFeel(filterButton); Font font = filterButton.getFont(); filterButton.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); filterButton.setIcon(icons.getIcon(IconManager.UP_DOWN_9_12)); filterButton.setBackground(UIUtilities.BACKGROUND_COLOR); filterButton.addMouseListener(new MouseAdapter() { /** * Brings up the menu. * @see MouseListener#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent me) { Object source = me.getSource(); if (source instanceof Component) displayMenu((Component) source, me.getPoint()); } }); otherRating = new JLabel(); otherRating.setBackground(UIUtilities.BACKGROUND_COLOR); font = otherRating.getFont(); otherRating.setFont(font.deriveFont(Font.ITALIC, font.getSize() - 2)); content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); tagFlag = false; docFlag = false; otherFlag = false; tagNames = new ArrayList<String>(); tagsDocList = new ArrayList<DocComponent>(); filesDocList = new ArrayList<DocComponent>(); otherList = new ArrayList<DocComponent>(); existingTags = new HashMap<String, TagAnnotationData>(); addTagsButton = new JButton(icons.getIcon(IconManager.PLUS_12)); UIUtilities.unifiedButtonLookAndFeel(addTagsButton); addTagsButton.setBackground(UIUtilities.BACKGROUND_COLOR); addTagsButton.setToolTipText("Add Tags."); addTagsButton.addActionListener(controller); addTagsButton.setActionCommand("" + EditorControl.ADD_TAGS); addDocsButton = new JButton(icons.getIcon(IconManager.PLUS_12)); addDocsButton.setBackground(UIUtilities.BACKGROUND_COLOR); addDocsButton.setToolTipText("Attach a document."); addDocsButton.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { if (addDocsButton.isEnabled()) { Point p = e.getPoint(); createDocSelectionMenu().show(addDocsButton, p.x, p.y); } } }); UIUtilities.unifiedButtonLookAndFeel(addDocsButton); removeTagsButton = new JButton(icons.getIcon(IconManager.MINUS_12)); UIUtilities.unifiedButtonLookAndFeel(removeTagsButton); removeTagsButton.setBackground(UIUtilities.BACKGROUND_COLOR); removeTagsButton.setToolTipText("Remove Tags."); removeTagsButton.addMouseListener(controller); removeTagsButton.setActionCommand("" + EditorControl.REMOVE_TAGS); removeDocsButton = new JButton(icons.getIcon(IconManager.MINUS_12)); UIUtilities.unifiedButtonLookAndFeel(removeDocsButton); removeDocsButton.setBackground(UIUtilities.BACKGROUND_COLOR); removeDocsButton.setToolTipText("Remove Attachments."); removeDocsButton.addMouseListener(controller); removeDocsButton.setActionCommand("" + EditorControl.REMOVE_DOCS); removeOtherAnnotationsButton = new JButton(icons.getIcon(IconManager.MINUS_12)); UIUtilities.unifiedButtonLookAndFeel(removeOtherAnnotationsButton); removeOtherAnnotationsButton.setBackground(UIUtilities.BACKGROUND_COLOR); removeOtherAnnotationsButton.setToolTipText("Remove Annotations."); removeOtherAnnotationsButton.addMouseListener(controller); removeOtherAnnotationsButton.setActionCommand("" + EditorControl.REMOVE_OTHER_ANNOTATIONS); selectedValue = 0; initialValue = selectedValue; rating = new RatingComponent(selectedValue, RatingComponent.MEDIUM_SIZE); rating.setOpaque(false); rating.setBackground(UIUtilities.BACKGROUND_COLOR); rating.addPropertyChangeListener(this); unrateButton = new JButton(icons.getIcon(IconManager.MINUS_12)); UIUtilities.unifiedButtonLookAndFeel(unrateButton); unrateButton.setBackground(UIUtilities.BACKGROUND_COLOR); unrateButton.setToolTipText("Unrate."); unrateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rating.setValue(0); view.saveData(true); } }); tagsPane = new JPanel(); tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS)); tagsPane.setBackground(UIUtilities.BACKGROUND_COLOR); DocComponent doc = new DocComponent(null, model); tagsDocList.add(doc); tagsPane.add(doc); docPane = new JPanel(); docPane.setLayout(new BoxLayout(docPane, BoxLayout.Y_AXIS)); docPane.setBackground(UIUtilities.BACKGROUND_COLOR); docRef = docPane; doc = new DocComponent(null, model); filesDocList.add(doc); docPane.add(doc); publishedBox = new JCheckBox(); publishedBox.setBackground(UIUtilities.BACKGROUND_COLOR); publishedBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { firePropertyChange(EditorControl.SAVE_PROPERTY, Boolean.FALSE, Boolean.TRUE); } }); mapsPane = new MapAnnotationsComponent(model, view); otherPane = new JPanel(); otherPane.setLayout(new GridBagLayout()); otherPane.setBackground(UIUtilities.BACKGROUND_COLOR); }
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.table.JTableInfoForCMFile.java
synchronized public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);// www. j a v a 2 s.c o m if (value == null) { comp.setToolTipText(null); return comp; } comp.setToolTipText(String.valueOf(value)); if (row >= table.getRowCount()) { log.debug("row > table.getRowCount()"); return comp; } switch (column) { case TableModelForCMFile.COL_COMPONENT_NAME: case TableModelForCMFile.COL_LICENSE_NAME: setHorizontalAlignment(SwingConstants.LEFT); break; case TableModelForCMFile.COL_VERSION_NAME: case TableModelForCMFile.COL_USAGE: case TableModelForCMFile.COL_STATUS: case TableModelForCMFile.COL_PERCENTAGE: case TableModelForCMFile.COL_MATCHED_FILE: setHorizontalAlignment(SwingConstants.CENTER); break; } if (table.getValueAt(row, TableModelForCMFile.COL_STATUS) == null) return comp; String status = table.getValueAt(row, TableModelForCMFile.COL_STATUS).toString(); String licenseName = table.getValueAt(row, TableModelForCMFile.COL_LICENSE_NAME).toString(); if (status.equals(AbstractMatchInfo.IDENTIFIED)) { comp.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12)); comp.setForeground(NORMAL_COLOR); } else if ((status.equals(AbstractMatchInfo.REJECTED)) || (status.equals(AbstractMatchInfo.DECLARED))) { comp.setForeground(new Color(150, 150, 150)); } else if (status.equals(AbstractMatchInfo.PENDING)) { if (identifiedStringSearchLicense != null && !identifiedStringSearchLicense.equals("")) { String currentRowLicense = "" + licenseName; if (identifiedStringSearchLicense.equals(currentRowLicense)) { comp.setForeground(NORMAL_COLOR); } else { comp.setForeground(GRAY_COLOR); } } else { comp.setForeground(NORMAL_COLOR); } } return comp; }
From source file:lucee.runtime.tag.Chart.java
public void setFontitalic(boolean fontitalic) { if (fontitalic) fontstyle += Font.ITALIC; }
From source file:net.sf.jabref.gui.RightClickMenu.java
/** Sets the font and icon to be used, depending on the group */ private void setGroupFontAndIcon(JMenuItem menuItem, AbstractGroup group) { if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_DYNAMIC)) { menuItem.setFont(menuItem.getFont().deriveFont(group.isDynamic() ? Font.ITALIC : Font.PLAIN)); }/*from w ww .j av a 2s .com*/ if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_ICONS)) { switch (group.getHierarchicalContext()) { case INCLUDING: menuItem.setIcon(IconTheme.JabRefIcon.GROUP_INCLUDING.getSmallIcon()); break; case REFINING: menuItem.setIcon(IconTheme.JabRefIcon.GROUP_REFINING.getSmallIcon()); break; default: menuItem.setIcon(IconTheme.JabRefIcon.GROUP_REGULAR.getSmallIcon()); break; } } }
From source file:org.wings.style.CSSStyleSheet.java
public static CSSAttributeSet getAttributes(SFont font) { CSSAttributeSet attributes = new CSSAttributeSet(); if (font == null) return attributes; String face = font.getFace(); if (face != null && face.length() == 0) face = null;// w ww . ja v a 2 s. c o m boolean italic = (font.getStyle() & Font.ITALIC) > 0; boolean bold = (font.getStyle() & Font.BOLD) > 0; int size = font.getSize(); if (face != null && size != -1) { // use font property StringBuilder builder = new StringBuilder(); if (italic) { builder.append("italic "); } if (bold) { builder.append("bold "); } if (size > 0) { builder.append(size); builder.append("pt "); } if (face != null && face.length() > 0) { builder.append(face); } attributes.put(CSSProperty.FONT, builder.toString()); } else { // use special properties if (italic) attributes.put(CSSProperty.FONT_STYLE, "italic"); if (bold) attributes.put(CSSProperty.FONT_WEIGHT, "bold"); if (size > -1) attributes.put(CSSProperty.FONT_SIZE, size + "pt"); if (face != null) attributes.put(CSSProperty.FONT_FAMILY, face); } return attributes; }
From source file:sim.util.media.chart.ChartGenerator.java
/** Generates a new ChartGenerator with a blank chart. Before anything else, buildChart() is called. */ public ChartGenerator() { // create the chart buildChart();/*w w w . ja va 2s . c o m*/ chart.getPlot().setBackgroundPaint(Color.WHITE); chart.setAntiAlias(true); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); split.setBorder(new EmptyBorder(0, 0, 0, 0)); JScrollPane scroll = new JScrollPane(); JPanel b = new JPanel(); b.setLayout(new BorderLayout()); b.add(seriesAttributes, BorderLayout.NORTH); b.add(new JPanel(), BorderLayout.CENTER); scroll.getViewport().setView(b); scroll.setBackground(getBackground()); scroll.getViewport().setBackground(getBackground()); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); LabelledList list = new LabelledList("Chart Properties"); DisclosurePanel pan1 = new DisclosurePanel("Chart Properties", list); globalAttributes.add(pan1); JLabel j = new JLabel("Right-Click or Control-Click"); j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC)); list.add(j); j = new JLabel("on Chart for More Options"); j.setFont(j.getFont().deriveFont(10.0f).deriveFont(java.awt.Font.ITALIC)); list.add(j); titleField = new PropertyField() { public String newValue(String newValue) { setTitle(newValue); getChartPanel().repaint(); return newValue; } }; titleField.setValue(chart.getTitle().getText()); list.add(new JLabel("Title"), titleField); buildGlobalAttributes(list); final JCheckBox legendCheck = new JCheckBox(); ItemListener il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { LegendTitle title = new LegendTitle(chart.getPlot()); title.setLegendItemGraphicPadding(new org.jfree.ui.RectangleInsets(0, 8, 0, 4)); chart.addLegend(title); } else { chart.removeLegend(); } } }; legendCheck.addItemListener(il); list.add(new JLabel("Legend"), legendCheck); legendCheck.setSelected(true); /* final JCheckBox aliasCheck = new JCheckBox(); aliasCheck.setSelected(chart.getAntiAlias()); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { chart.setAntiAlias( e.getStateChange() == ItemEvent.SELECTED ); } }; aliasCheck.addItemListener(il); list.add(new JLabel("Antialias"), aliasCheck); */ JPanel pdfButtonPanel = new JPanel(); pdfButtonPanel.setBorder(new javax.swing.border.TitledBorder("Chart Output")); DisclosurePanel pan2 = new DisclosurePanel("Chart Output", pdfButtonPanel); pdfButtonPanel.setLayout(new BorderLayout()); Box pdfbox = new Box(BoxLayout.Y_AXIS); pdfButtonPanel.add(pdfbox, BorderLayout.WEST); JButton pdfButton = new JButton("Save as PDF"); pdfbox.add(pdfButton); pdfButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FileDialog fd = new FileDialog(frame, "Choose PDF file...", FileDialog.SAVE); fd.setFile(chart.getTitle().getText() + ".pdf"); fd.setVisible(true); String fileName = fd.getFile(); if (fileName != null) { Dimension dim = chartPanel.getPreferredSize(); PDFEncoder.generatePDF(chart, dim.width, dim.height, new File(fd.getDirectory(), Utilities.ensureFileEndsWith(fd.getFile(), ".pdf"))); } } }); movieButton = new JButton("Create a Movie"); pdfbox.add(movieButton); pdfbox.add(Box.createGlue()); movieButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (movieMaker == null) startMovie(); else stopMovie(); } }); globalAttributes.add(pan2); // we add into an outer box so we can later on add more global seriesAttributes // as the user instructs and still have glue be last Box outerAttributes = Box.createVerticalBox(); outerAttributes.add(globalAttributes); outerAttributes.add(Box.createGlue()); p.add(outerAttributes, BorderLayout.NORTH); p.add(scroll, BorderLayout.CENTER); p.setMinimumSize(new Dimension(0, 0)); p.setPreferredSize(new Dimension(200, 0)); split.setLeftComponent(p); // Add scale and proportion fields Box header = Box.createHorizontalBox(); final double MAXIMUM_SCALE = 8; fixBox = new JCheckBox("Fill"); fixBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFixed(fixBox.isSelected()); } }); header.add(fixBox); fixBox.setSelected(true); // add the scale field scaleField = new NumberTextField(" Scale: ", 1.0, true) { public double newValue(double newValue) { if (newValue <= 0.0) newValue = currentValue; if (newValue > MAXIMUM_SCALE) newValue = currentValue; scale = newValue; resizeChart(); return newValue; } }; scaleField.setToolTipText("Zoom in and out"); scaleField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); scaleField.setEnabled(false); scaleField.setText(""); header.add(scaleField); // add the proportion field proportionField = new NumberTextField(" Proportion: ", 1.5, true) { public double newValue(double newValue) { if (newValue <= 0.0) newValue = currentValue; proportion = newValue; resizeChart(); return newValue; } }; proportionField.setToolTipText("Change the chart proportions (ratio of width to height)"); proportionField.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); header.add(proportionField); chartHolder.setMinimumSize(new Dimension(0, 0)); chartHolder.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); chartHolder.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); chartHolder.getViewport().setBackground(Color.gray); JPanel p2 = new JPanel(); p2.setLayout(new BorderLayout()); p2.add(chartHolder, BorderLayout.CENTER); p2.add(header, BorderLayout.NORTH); split.setRightComponent(p2); setLayout(new BorderLayout()); add(split, BorderLayout.CENTER); // set the default to be white, which looks good when printed chart.setBackgroundPaint(Color.WHITE); // JFreeChart has a hillariously broken way of handling font scaling. // It allows fonts to scale independently in X and Y. We hack a workaround here. chartPanel.setMinimumDrawHeight((int) DEFAULT_CHART_HEIGHT); chartPanel.setMaximumDrawHeight((int) DEFAULT_CHART_HEIGHT); chartPanel.setMinimumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion)); chartPanel.setMaximumDrawWidth((int) (DEFAULT_CHART_HEIGHT * proportion)); chartPanel.setPreferredSize(new java.awt.Dimension((int) (DEFAULT_CHART_HEIGHT * DEFAULT_CHART_PROPORTION), (int) (DEFAULT_CHART_HEIGHT))); }