List of usage examples for java.awt Font BOLD
int BOLD
To view the source code for java.awt Font BOLD.
Click Source Link
From source file:de.mendelson.comm.as2.AS2.java
/**Method to start the server on from the command line*/ public static void main(String args[]) { // TODO remove cleanup();//from w w w .ja v a2 s .c o m String language = null; boolean startHTTP = true; boolean allowAllClients = false; int optind; for (optind = 0; optind < args.length; optind++) { if (args[optind].toLowerCase().equals("-lang")) { language = args[++optind]; } else if (args[optind].toLowerCase().equals("-nohttpserver")) { startHTTP = false; } else if (args[optind].toLowerCase().equals("-allowallclients")) { allowAllClients = true; } else if (args[optind].toLowerCase().equals("-?")) { AS2.printUsage(); System.exit(1); } else if (args[optind].toLowerCase().equals("-h")) { AS2.printUsage(); System.exit(1); } else if (args[optind].toLowerCase().equals("-help")) { AS2.printUsage(); System.exit(1); } } //load language from preferences if (language == null) { PreferencesAS2 preferences = new PreferencesAS2(); language = preferences.get(PreferencesAS2.LANGUAGE); } if (language != null) { if (language.toLowerCase().equals("en")) { Locale.setDefault(Locale.ENGLISH); } else if (language.toLowerCase().equals("de")) { Locale.setDefault(Locale.GERMAN); } else if (language.toLowerCase().equals("fr")) { Locale.setDefault(Locale.FRENCH); } else { AS2.printUsage(); System.out.println(); System.out.println("Language " + language + " is not supported."); System.exit(1); } } Splash splash = new Splash("/de/mendelson/comm/as2/client/Splash.jpg"); AffineTransform transform = new AffineTransform(); splash.setTextAntiAliasing(false); transform.setToScale(1.0, 1.0); splash.addDisplayString(new Font("Verdana", Font.BOLD, 11), 7, 262, AS2ServerVersion.getFullProductName(), new Color(0x65, 0xB1, 0x80), transform); splash.setVisible(true); splash.toFront(); //start server try { //register the database drivers for the VM Class.forName("org.hsqldb.jdbcDriver"); //initialize the security provider BCCryptoHelper helper = new BCCryptoHelper(); helper.initialize(); AS2Server as2Server = new AS2Server(startHTTP, allowAllClients); AS2Agent agent = new AS2Agent(as2Server); } catch (UpgradeRequiredException e) { //an upgrade to HSQLDB 2.x is required, delete the lock file Logger.getLogger(AS2Server.SERVER_LOGGER_NAME).warning(e.getMessage()); JOptionPane.showMessageDialog(null, e.getClass().getName() + ": " + e.getMessage()); AS2Server.deleteLockFile(); System.exit(1); } catch (Throwable e) { if (splash != null) { splash.destroy(); } JOptionPane.showMessageDialog(null, e.getMessage()); System.exit(1); } //start client AS2Gui gui = new AS2Gui(splash, "localhost"); gui.setVisible(true); splash.destroy(); splash.dispose(); }
From source file:com.adobe.aem.demomachine.gui.AemDemo.java
public static void main(String[] args) { String demoMachineRootFolder = null; // Command line options for this tool Options options = new Options(); options.addOption("f", true, "Path to Demo Machine root folder"); CommandLineParser parser = new BasicParser(); try {/*from www. jav a 2 s.co m*/ CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("f")) { demoMachineRootFolder = cmd.getOptionValue("f"); } } catch (ParseException ex) { logger.error(ex.getMessage()); } // Let's grab the version number for the core Maven file String mavenFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "java" + File.separator + "core" + File.separator + "pom.xml"; File mavenFile = new File(mavenFilePath); if (mavenFile.exists() && !mavenFile.isDirectory()) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document document; document = builder.parse(mavenFile); NodeList list = document.getElementsByTagName("version"); if (list != null && list.getLength() > 0) { aemDemoMachineVersion = list.item(0).getFirstChild().getNodeValue(); } } catch (Exception e) { logger.error("Can't parse Maven pom.xml file"); } } // Let's check if we have a valid build.xml file to work with... String buildFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "build.xml"; logger.debug("Trying to load build file from " + buildFilePath); buildFile = new File(buildFilePath); if (buildFile.exists() && !buildFile.isDirectory()) { // Launching the main window EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14)); AemDemo window = new AemDemo(); window.frameMain.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } else { logger.error("No valid build.xml file to work with"); System.exit(-1); } }
From source file:ComponentTree.java
/** * This main() method demonstrates the use of the ComponentTree class: it * puts a ComponentTree component in a Frame, and uses the ComponentTree to * display its own GUI hierarchy. It also adds a TreeSelectionListener to * display additional information about each component as it is selected *//*w ww . j ava2 s . co m*/ public static void main(String[] args) { // Create a frame for the demo, and handle window close requests JFrame frame = new JFrame("ComponentTree Demo"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // Create a scroll pane and a "message line" and add them to the // center and bottom of the frame. JScrollPane scrollpane = new JScrollPane(); final JLabel msgline = new JLabel(" "); frame.getContentPane().add(scrollpane, BorderLayout.CENTER); frame.getContentPane().add(msgline, BorderLayout.SOUTH); // Now create the ComponentTree object, specifying the frame as the // component whose tree is to be displayed. Also set the tree's font. JTree tree = new ComponentTree(frame); tree.setFont(new Font("SansSerif", Font.BOLD, 12)); // Only allow a single item in the tree to be selected at once tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); // Add an event listener for notifications when // the tree selection state changes. tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { // Tree selections are referred to by "path" // We only care about the last node in the path TreePath path = e.getPath(); Component c = (Component) path.getLastPathComponent(); // Now we know what component was selected, so // display some information about it in the message line if (c.isShowing()) { Point p = c.getLocationOnScreen(); msgline.setText("x: " + p.x + " y: " + p.y + " width: " + c.getWidth() + " height: " + c.getHeight()); } else { msgline.setText("component is not showing"); } } }); // Now that we've set up the tree, add it to the scrollpane scrollpane.setViewportView(tree); // Finally, set the size of the main window, and pop it up. frame.setSize(600, 400); frame.setVisible(true); }
From source file:Main.java
public static String getStyleFromInteger(int style) { if (style == Font.BOLD) return "BOLD"; else if (style == Font.ITALIC) return "ITALIC"; else//from w ww . j av a2 s . c o m return "PLAIN"; }
From source file:Main.java
public static void boldLabel(JLabel label) { label.setFont(label.getFont().deriveFont(Font.BOLD)); }
From source file:Main.java
public static JLabel setTitleLabelFont(JLabel label) { return modifyLabelFont(label, Font.BOLD, 0); }
From source file:Main.java
public static JLabel setSmallLabelFont(JLabel label) { return modifyLabelFont(label, Font.BOLD, 0); }
From source file:Main.java
/** * Tries to derive a default header font from given context. * /*from w ww . j a v a2 s . c om*/ * @param context * @return */ public static Font deriveHeader2(Component context) { return context.getFont().deriveFont(Font.BOLD, 12); }
From source file:Main.java
public static Font createBoldFont(Font font) { if (font == null) { throw new NullPointerException("font == null"); }/* w w w.j a v a2 s. co m*/ String fontName = font.getName(); int fontSize = font.getSize(); return new Font(fontName, Font.BOLD, fontSize); }
From source file:Main.java
public static Font boldFont(Font baseFont) { return baseFont.deriveFont(Font.BOLD); }