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:net.sf.jasperreports.engine.fonts.FontUtil.java
/** * Returns font information containing the font family, font face and font style. * // ww w . j a va 2s .com * @param name the font family or font face name * @param ignoreCase the flag to specify if family names or face names are searched by ignoring case or not * @param locale the locale * @return a font info object */ public FontInfo getFontInfo(String name, boolean ignoreCase, Locale locale) { FontInfo awtFamilyMatchFontInfo = null; //FIXMEFONT do some cache List<FontFamily> families = jasperReportsContext.getExtensions(FontFamily.class); for (Iterator<FontFamily> itf = families.iterator(); itf.hasNext();) { FontFamily family = itf.next(); if (locale == null || family.supportsLocale(locale)) { if (equals(name, family.getName(), ignoreCase)) { return new FontInfo(family, null, Font.PLAIN); } FontFace face = family.getNormalFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.PLAIN); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.PLAIN); } } face = family.getBoldFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.BOLD); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.BOLD); } } face = family.getItalicFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.ITALIC); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.ITALIC); } } face = family.getBoldItalicFace(); if (face != null) { if (equals(name, face.getName(), ignoreCase)) { return new FontInfo(family, face, Font.BOLD | Font.ITALIC); } else if (awtFamilyMatchFontInfo == null && face.getFont() != null && equals(name, face.getFont().getFamily(), ignoreCase)) { awtFamilyMatchFontInfo = new FontInfo(family, face, Font.BOLD | Font.ITALIC); } } } } return awtFamilyMatchFontInfo; }
From source file:dpcs.About.java
public About() { setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png"))); setResizable(false);//from ww w. jav a 2 s . co m setType(Type.UTILITY); setTitle("About"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 540, 400); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); try { InputStreamReader reader2 = new InputStreamReader( getClass().getResourceAsStream("/others/app-version.txt")); String tmp = IOUtils.toString(reader2); AppVersion = Double.parseDouble(tmp); } catch (IOException e1) { e1.printStackTrace(); } JButton btnGitHub = new JButton("GitHub"); btnGitHub.setToolTipText("Access Droid PC Suite github repository"); btnGitHub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnGitHub.setBounds(369, 295, 111, 25); contentPane.add(btnGitHub); JLabel lblMyFriend4 = new JLabel("Gulati-kun"); lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend4.setBounds(25, 266, 242, 24); contentPane.add(lblMyFriend4); JLabel lblMyFriend3 = new JLabel("Anil-kun"); lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend3.setBounds(25, 242, 242, 24); contentPane.add(lblMyFriend3); JLabel lblMyFriend2 = new JLabel("Suri-kun"); lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend2.setBounds(25, 217, 242, 24); contentPane.add(lblMyFriend2); JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion); lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14)); lblApplicationVersion.setBounds(382, 16, 132, 18); contentPane.add(lblApplicationVersion); JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)"); lblForMyOther.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e) { e.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblForMyOther.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblForMyOther.setForeground(Color.BLACK); } }); lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15)); lblForMyOther.setBounds(25, 321, 502, 24); contentPane.add(lblForMyOther); JLabel lblMySensei2 = new JLabel("Karun Sensei"); lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei2.setBounds(25, 120, 242, 24); contentPane.add(lblMySensei2); JLabel lblMySensei1 = new JLabel("Prashotam Sensei"); lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei1.setBounds(25, 98, 242, 24); contentPane.add(lblMySensei1); JLabel lblDaretobe = new JLabel("D4r3T0B3"); lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15)); lblDaretobe.setBounds(25, 194, 242, 24); contentPane.add(lblDaretobe); JLabel label_9 = new JLabel(""); label_9.setToolTipText("This variation of android robot is created using Androidify"); label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png"))); label_9.setBounds(334, 50, 180, 270); contentPane.add(label_9); JLabel lblDeveloper = new JLabel("Developer"); lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16)); lblDeveloper.setBounds(25, 12, 233, 24); contentPane.add(lblDeveloper); JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi"); lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24); contentPane.add(lblMrAleksandarDespotovski_shi); JLabel lblMyname = new JLabel("Karanvir Singh"); lblMyname.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e1) { e1.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblMyname.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblMyname.setForeground(Color.RED); } }); lblMyname.setForeground(Color.RED); lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16)); lblMyname.setBounds(25, 36, 242, 24); contentPane.add(lblMyname); JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun"); lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend1.setBounds(25, 145, 242, 24); contentPane.add(lblMyFriend1); JLabel label_6 = new JLabel("Special thanks to"); label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow")); label_6.setFont(new Font("Dialog", Font.BOLD, 16)); label_6.setBounds(25, 71, 240, 25); contentPane.add(label_6); JLabel lblGoogle = new JLabel( "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way."); lblGoogle.setHorizontalAlignment(SwingConstants.LEFT); lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8)); lblGoogle.setBounds(25, 341, 514, 24); contentPane.add(lblGoogle); }
From source file:net.sf.jasperreports.engine.util.JRFontUtil.java
/** * *//*from w w w.j av a2s . co m*/ public static Font getAwtFontFromBundles(String name, int style, int size, Locale locale, boolean ignoreMissingFont) { Font awtFont = null; FontInfo fontInfo = getFontInfo(name, locale); if (fontInfo != null) { int faceStyle = Font.PLAIN; FontFamily family = fontInfo.getFontFamily(); FontFace face = fontInfo.getFontFace(); if (face == null) { if (((style & Font.BOLD) > 0) && ((style & Font.ITALIC) > 0)) { face = family.getBoldItalicFace(); faceStyle = Font.BOLD | Font.ITALIC; } if (face == null && ((style & Font.BOLD) > 0)) { face = family.getBoldFace(); faceStyle = Font.BOLD; } if (face == null && ((style & Font.ITALIC) > 0)) { face = family.getItalicFace(); faceStyle = Font.ITALIC; } if (face == null) { face = family.getNormalFace(); faceStyle = Font.PLAIN; } // if (face == null) // { // throw new JRRuntimeException("Font family '" + family.getName() + "' does not have the normal font face."); // } } else { faceStyle = fontInfo.getStyle(); } if (face == null) { // The font family does not specify any font face, not even a normal one. // In such case, we take the family name and consider it as JVM available font name. checkAwtFont(family.getName(), ignoreMissingFont); awtFont = new Font(family.getName(), style, size); } else { awtFont = face.getFont(); if (awtFont == null) { throw new JRRuntimeException("The '" + face.getName() + "' font face in family '" + family.getName() + "' returns a null font."); } awtFont = awtFont.deriveFont((float) size); awtFont = awtFont.deriveFont(style & ~faceStyle); } } return awtFont; }
From source file:ome.formats.importer.gui.OptionsDialog.java
/** * Initialize and show the options dialog * /* w w w . j a v a 2 s .c o m*/ * @param config - ImportConfig to store/save settings too * @param owner - parent * @param title - dialog title * @param modal - modal yes/no */ OptionsDialog(ImportConfig config, JFrame owner, String title, boolean modal) { super(owner); this.owner = owner; setLocation(200, 200); setTitle(title); setModal(modal); setResizable(false); setSize(new Dimension(dialogWidth, dialogHeight)); setLocationRelativeTo(owner); tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); // content panes must be opaque this.config = config; oldQuaquaLevel = config.getUseQuaqua(); oldUserDisableHistory = config.getUserDisableHistory(); /////////////////////// START MAIN PANEL //////////////////////// // Set up the main pane double mainPanelTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.FILL, 5, 30 } }; // rows mainPanel = GuiCommonElements.addMainPanel(this, mainPanelTable, 10, 10, 10, 10, debug); // Buttons at the bottom of the form cancelBtn = GuiCommonElements.addButton(mainPanel, "Cancel", 'L', "Cancel", "1, 2, f, c", debug); cancelBtn.addActionListener(this); okBtn = GuiCommonElements.addButton(mainPanel, "OK", 'Q', "Import", "3, 2, f, c", debug); okBtn.addActionListener(this); this.getRootPane().setDefaultButton(okBtn); GuiCommonElements.enterPressesWhenFocused(okBtn); mainPanel.add(tabbedPane, "0,0,4,0"); /////////////////////// START DEBUG OPTIONS PANEL //////////////////////// double debugOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows debugOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, debugOptionTable, 0, 10, 10, 10, debug); String message = "Choose the level of detail for your log file's data."; GuiCommonElements.addTextPane(debugOptionsPanel, message, "0, 1, 0, 0", debug); dBox = GuiCommonElements.addComboBox(debugOptionsPanel, "Debug Level: ", debugItems, 'D', "Choose the level of detail for your log file's data.", 95, "0,3,F,C", debug); int debugLevel = config.getDebugLevel(); for (int i = 0; i < dBox.getItemCount(); i++) { if (((DebugItem) dBox.getItemAt(i)).getLevel() == debugLevel) dBox.setSelectedIndex(i); } dBox.addActionListener(this); String description = ((DebugItem) dBox.getSelectedItem()).getDescription(); descriptionText = GuiCommonElements.addTextPane(debugOptionsPanel, description, "0, 5", debug); final Font textFieldFont = (Font) UIManager.get("TextField.font"); final Font font = new Font(textFieldFont.getFamily(), Font.ITALIC, textFieldFont.getSize()); descriptionText.setFont(font); /////////////////////// START OTHER OPTIONS PANEL //////////////////////// double otherOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows otherOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, otherOptionTable, 0, 10, 10, 10, debug); companionFileCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Attached a text file to each imported" + " file containing all collected metadata.</html>", "0,1", debug); companionFileCheckbox.setSelected(config.companionFile.get()); disableHistoryCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Disable Import History. (Improves " + " import speed. Restart required if changed).</html>", "0,3", debug); disableHistoryCheckbox.setSelected(config.getUserDisableHistory()); // If disabled by admin in import.config, disable this option if (config.getStaticDisableHistory()) { disableHistoryCheckbox.setEnabled(false); } /////////////////////// START FILECHOOSER PANEL //////////////////////// // Set up the import panel for tPane, quit, and send buttons double fileChooserTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.PREFERRED, 15, TableLayout.FILL, 10 } }; // rows fileChooserPanel = GuiCommonElements.addMainPanel(tabbedPane, fileChooserTable, 0, 10, 0, 10, debug); message = "Switch between single pane view and triple pane view. " + "You will need to reboot the importer before your changes will take effect."; GuiCommonElements.addTextPane(fileChooserPanel, message, "0, 0, 4, 0", debug); // Set up single pane table double singlePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the single pane layout singlePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, singlePaneTable, 0, 0, 0, 0, debug); singlePaneBtn = GuiCommonElements.addRadioButton(singlePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(singlePanePanel, SINGLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(singlePanePanel, "0, 2, 1, 2"); // Set up triple pane table double triplePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the triple pane layout triplePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, triplePaneTable, 0, 0, 0, 0, debug); triplePaneBtn = GuiCommonElements.addRadioButton(triplePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(triplePanePanel, TRIPLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(triplePanePanel, "3, 2, 4, 2"); ButtonGroup group = new ButtonGroup(); group.add(singlePaneBtn); group.add(triplePaneBtn); if (config.getUseQuaqua() == true) { triplePaneBtn.setSelected(true); singlePaneBtn.setSelected(false); } else { triplePaneBtn.setSelected(false); singlePaneBtn.setSelected(true); } /////////////////////// START TABBED PANE //////////////////////// //if (GuiCommonElements.getIsMac()) tabbedPane.addTab("FileChooser", null, fileChooserPanel, "FileChooser Settings"); tabbedPane.addTab("Debug", null, debugOptionsPanel, "Debug Settings"); tabbedPane.addTab("Other", null, otherOptionsPanel, "Other Settings"); this.add(mainPanel); setVisible(true); }
From source file:wef.articulab.view.ui.CombinedBNXYPlot.java
private XYPlot createPlot(ChartContainer chartContainer) { createDataset(chartContainer);//from ww w . j a v a 2 s .c om chartContainer.target = new IntervalMarker(14, 16); chartContainer.target.setLabel("Activation Threshold"); chartContainer.target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); chartContainer.target.setLabelAnchor(RectangleAnchor.LEFT); chartContainer.target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); chartContainer.target.setPaint(new Color(222, 222, 255, 128)); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); BasicStroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); for (int i = 0; i < chartContainer.series.length - 1; i++) { renderer.setSeriesStroke(i, stroke); } renderer.setSeriesStroke(chartContainer.series.length - 1, new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.0f }, 0.0f)); NumberAxis rangeAxis = new NumberAxis("Activation"); NumberAxis domainAxis = new NumberAxis("Time"); XYPlot plot = new XYPlot(chartContainer.dataset, domainAxis, rangeAxis, renderer); plot.addRangeMarker(chartContainer.target, Layer.BACKGROUND); plot.setRenderer(renderer); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setBackgroundPaint(Color.LIGHT_GRAY); chartContainer.plot = plot; return plot; }
From source file:nz.govt.natlib.ndha.manualdeposit.dialogs.ApplicationProperties.java
private void setNewFont() { final String fontName = txtFont.getText(); txtFont.setText(fontName);/*from w w w. j a va 2 s . com*/ final String fontStyle = txtFontStyle.getText(); int style; if (fontStyle == null) { style = Font.PLAIN; } else if (fontStyle.equalsIgnoreCase("Bold Italic")) { style = Font.BOLD + Font.ITALIC; } else if (fontStyle.equalsIgnoreCase("Bold")) { style = Font.BOLD; } else if (fontStyle.equalsIgnoreCase("Italic")) { style = Font.ITALIC; } else { style = Font.PLAIN; } int fontSize = 11; try { fontSize = Integer.parseInt(txtFontSize.getText()); } catch (Exception ex) { LOG.error("Error parsing font size", ex); } theStandardFont = new Font(fontName, style, fontSize); FormUtilities.setFormFont(this, theStandardFont); lstFont.ensureIndexIsVisible(lstFont.getSelectedIndex()); lstSize.ensureIndexIsVisible(lstSize.getSelectedIndex()); lstStyle.ensureIndexIsVisible(lstStyle.getSelectedIndex()); }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java
/** * Sets the text explaining the component when the component is a list * or a map.// www . ja va 2 s . c o m * * @param text The value to set. */ void setInfo(String text) { if (StringUtils.isBlank(text)) return; info = new JLabel(); Font f = info.getFont(); info.setFont(f.deriveFont(Font.ITALIC, f.getSize() - 2)); }
From source file:main.java.gui.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - BOHDAN Korinnyi test = new JFrame(); label1 = new JLabel(); textField1 = new JTextField(); label2 = new JLabel(); textField2 = new JTextField(); label3 = new JLabel(); label4 = new JLabel(); textField3 = new JTextField(); textField4 = new JTextField(); button1 = new JButton(); button2 = new JButton(); label5 = new JLabel(); label6 = new JLabel(); //======== test ======== {/* w ww . ja v a2 s . c o m*/ test.setTitle("Pay mobile account"); Container testContentPane = test.getContentPane(); testContentPane.setLayout(null); //---- label1 ---- label1.setText("\u0421\u0443\u043c\u0430"); label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 4f)); testContentPane.add(label1); label1.setBounds(new Rectangle(new Point(35, 30), label1.getPreferredSize())); //---- textField1 ---- textField1.setColumns(10); testContentPane.add(textField1); textField1.setBounds(150, 30, 105, textField1.getPreferredSize().height); //---- label2 ---- label2.setText("\u041d\u043e\u043c\u0435\u0440"); label2.setFont(label2.getFont().deriveFont(label2.getFont().getSize() + 4f)); testContentPane.add(label2); label2.setBounds(new Rectangle(new Point(35, 60), label2.getPreferredSize())); //---- textField2 ---- textField2.setText("0674060606"); textField2.setFont(textField2.getFont().deriveFont(textField2.getFont().getSize() + 2f)); testContentPane.add(textField2); textField2.setBounds(150, 60, 105, textField2.getPreferredSize().height); //---- label3 ---- label3.setText("\u041b\u043e\u0433\u0456\u043d"); label3.setFont(label3.getFont().deriveFont(label3.getFont().getSize() + 4f)); testContentPane.add(label3); label3.setBounds(new Rectangle(new Point(35, 95), label3.getPreferredSize())); //---- label4 ---- label4.setText("\u041f\u0430\u0440\u043e\u043b\u044c"); label4.setFont(label4.getFont().deriveFont(label4.getFont().getSize() + 4f)); testContentPane.add(label4); label4.setBounds(new Rectangle(new Point(35, 125), label4.getPreferredSize())); testContentPane.add(textField3); textField3.setBounds(150, 95, 105, textField3.getPreferredSize().height); testContentPane.add(textField4); textField4.setBounds(150, 125, 105, 20); //---- button1 ---- button1.setText("\u041e\u043f\u043b\u0430\u0442\u0438\u0442\u0438"); button1.setFont(button1.getFont().deriveFont(button1.getFont().getStyle() | Font.BOLD, button1.getFont().getSize() + 2f)); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String strTemp = textField1.getText(); int cash = Integer.parseInt(strTemp); if (cash < 1) { JOptionPane.showMessageDialog(null, " '", "", JOptionPane.OK_OPTION); textField1.setText("0"); } else if (textField3.getText().equals("test4") && textField4.getText().equals("12345")) { check c = new check(); pay p = new pay(); getstatus g = new getstatus(); try { c.connection(c.PaymentCollectionRequest("38" + getNumber(), getMoney())); g.connection(c.PaymentStatusRequest()); p.connection(c.PaymentCollectionRequest("38" + getNumber(), getMoney())); g.connection(c.PaymentStatusRequest()); information i = new information(); daoImplements h = new daoImplements(); long curTime = System.currentTimeMillis(); String curStringDate = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(curTime); i.setIdTransaction(getTransaction.setGetTransaction()); i.setData(curStringDate); i.setNumber(Integer.parseInt(getNumber())); i.setSuma(Integer.parseInt(getMoney())); i.setStatus(parserStatus.getStatusParsing()); h.addInfo(i); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ParseException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } else { JOptionPane.showMessageDialog(null, " ", "", JOptionPane.OK_OPTION); System.exit(0); } } }); testContentPane.add(button1); button1.setBounds(150, 155, 115, 25); //---- button2 ---- button2.setText("\u0406\u0441\u0442\u043e\u0440\u0456\u044f"); button2.setFont(button2.getFont().deriveFont(button2.getFont().getStyle() | Font.BOLD, button2.getFont().getSize() + 2f)); button2.setActionCommand("\u0406\u0441\u0442\u043e\u0440\u0456\u044f"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tableData t = new tableData(); } }); testContentPane.add(button2); button2.setBounds(15, 155, 115, 25); //---- label5 ---- label5.setText( "\u0422\u0435\u0441\u0442\u043e\u0432\u0438\u0439 \u0441\u0435\u0440\u0432\u0456\u0441 \u043f\u043e\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u043c\u043e\u0431\u0456\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0445\u0443\u043d\u043a\u0443"); label5.setFont(label5.getFont().deriveFont(label5.getFont().getStyle() & ~Font.ITALIC)); testContentPane.add(label5); label5.setBounds(15, 0, 255, 20); //---- label6 ---- label6.setText("38"); label6.setFont(label6.getFont().deriveFont(label6.getFont().getSize() + 4f)); testContentPane.add(label6); label6.setBounds(new Rectangle(new Point(130, 60), label6.getPreferredSize())); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < testContentPane.getComponentCount(); i++) { Rectangle bounds = testContentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = testContentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; testContentPane.setMinimumSize(preferredSize); testContentPane.setPreferredSize(preferredSize); } test.pack(); test.setLocationRelativeTo(test.getOwner()); } // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.sdk.connector.chart.FrequencyDomainRenderer.java
/** * Creates a new demo application.//from w w w .j a va2 s . c o m * * @param title the frame title. */ public FrequencyDomainRenderer(String title, JPanel panel, String side, String type) { this.side = side; this.type = type; serie.setKey(side); dataset.addSeries(serie); JFreeChart chart = ChartFactory.createXYAreaChart(title, java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.xlabel"), java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("frequency.ylabel2"), dataset, PlotOrientation.VERTICAL, true, true, false); // TextTitle t1 = new TextTitle( "Espectro de Frequncia Estimado (PSD)", new Font("SansSerif", Font.BOLD, 14) ); // //TextTitle t2 = new TextTitle( "valores atualizados a cada potncia de 2", new Font("SansSerif", Font.PLAIN, 11) ); // chart.addSubtitle(t1); chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); chart.getRenderingHints().put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); chart.getRenderingHints().put(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); chart.getRenderingHints().put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); chart.getRenderingHints().put(RenderingHints.KEY_TEXT_LCD_CONTRAST, 100); //chart.addSubtitle(t2); plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLUE); plot.setRangeGridlinePaint(Color.CYAN); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f)); //plot.setRangePannable(true); plot.setForegroundAlpha(0.65f); //XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer = plot.getRenderer(); renderer.setSeriesOutlinePaint(0, Color.BLACK); if (side.startsWith( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("side.left"))) { renderer.setSeriesPaint(0, Color.BLUE); } else { renderer.setSeriesPaint(0, Color.RED); } // renderer.setSeriesLinesVisible(0, true); // renderer.setSeriesShapesVisible(0, false); // renderer.setSeriesLinesVisible(1, true); // renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); plot.setForegroundAlpha(0.5f); Color color1 = new Color(0, 0, 0, 24); Color color2 = new Color(255, 255, 255, 24); GradientPaint gp = new GradientPaint(0, 0, color1, 0, 0, color2); plot.setBackgroundPaint(gp); final ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickMarkPaint(Color.black); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); NumberAxis numDomainAxis = (NumberAxis) plot.getDomainAxis(); numDomainAxis.setAutoRangeIncludesZero(true); // // final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); // // plot.setRangeAxis(rangeAxis); final ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setTickMarkPaint(Color.black); numRangeAxis = (NumberAxis) plot.getRangeAxis(); numRangeAxis.setAutoRangeIncludesZero(true); vlfTarget.setLabel("VLF"); vlfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); vlfTarget.setLabelAnchor(RectangleAnchor.CENTER); vlfTarget.setLabelTextAnchor(TextAnchor.CENTER); vlfTarget.setPaint(new Color(0, 100, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(vlfTarget, Layer.BACKGROUND); lfTarget.setLabel("LF"); lfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); lfTarget.setLabelAnchor(RectangleAnchor.CENTER); lfTarget.setLabelTextAnchor(TextAnchor.CENTER); lfTarget.setPaint(new Color(255, 255, 0, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(lfTarget, Layer.BACKGROUND); hfTarget.setLabel("HF"); hfTarget.setLabelFont(new Font("SansSerif", Font.ITALIC, 9)); hfTarget.setLabelAnchor(RectangleAnchor.CENTER); hfTarget.setLabelTextAnchor(TextAnchor.CENTER); hfTarget.setPaint(new Color(255, 0, 255, 128)); // plot.addRangeMarker(target, Layer.BACKGROUND); plot.addDomainMarker(hfTarget, Layer.BACKGROUND); plot.setNoDataMessage( java.util.ResourceBundle.getBundle("com/sdk/connector/chart/Bundle").getString("message.wait")); chartPanel = new ChartPanel(chart); panel.setLayout(new GridLayout(0, 1)); panel.add(chartPanel); panel.repaint(); panel.revalidate(); }
From source file:ClassTree.java
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); // get the user object DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Class<?> c = (Class<?>) node.getUserObject(); // the first time, derive italic font from plain font if (plainFont == null) { plainFont = getFont();/*from w w w. j a v a 2 s . c o m*/ // the tree cell renderer is sometimes called with a label that has a null font if (plainFont != null) italicFont = plainFont.deriveFont(Font.ITALIC); } // set font to italic if the class is abstract, plain otherwise if ((c.getModifiers() & Modifier.ABSTRACT) == 0) setFont(plainFont); else setFont(italicFont); return this; }