List of usage examples for java.awt Font PLAIN
int PLAIN
To view the source code for java.awt Font PLAIN.
Click Source Link
From source file:TextBouncer.java
public static void main(String[] args) { String s = "Java Source and Support"; final int size = 64; if (args.length > 0) s = args[0];// w w w .j a v a2 s. c o m Panel controls = new Panel(); final Choice choice = new Choice(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] allFonts = ge.getAllFonts(); for (int i = 0; i < allFonts.length; i++) choice.addItem(allFonts[i].getName()); Font defaultFont = new Font(allFonts[0].getName(), Font.PLAIN, size); final TextBouncer bouncer = new TextBouncer(s, defaultFont); Frame f = new AnimationFrame(bouncer); f.setFont(new Font("Serif", Font.PLAIN, 12)); controls.add(bouncer.createCheckbox("Antialiasing", TextBouncer.ANTIALIASING)); controls.add(bouncer.createCheckbox("Gradient", TextBouncer.GRADIENT)); controls.add(bouncer.createCheckbox("Shear", TextBouncer.SHEAR)); controls.add(bouncer.createCheckbox("Rotate", TextBouncer.ROTATE)); controls.add(bouncer.createCheckbox("Axes", TextBouncer.AXES)); Panel fontControls = new Panel(); choice.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { Font font = new Font(choice.getSelectedItem(), Font.PLAIN, size); bouncer.setFont(font); } }); fontControls.add(choice); Panel allControls = new Panel(new GridLayout(2, 1)); allControls.add(controls); allControls.add(fontControls); f.add(allControls, BorderLayout.NORTH); f.setSize(300, 300); f.setVisible(true); }
From source file:Main.java
public static void plainLabel(JLabel label) { label.setFont(label.getFont().deriveFont(Font.PLAIN)); }
From source file:Main.java
public static void plainTextField(JTextField textField) { textField.setFont(textField.getFont().deriveFont(Font.PLAIN)); }
From source file:Main.java
/** * Tries to derive a default header font from given context. * // w w w . j a v a 2 s . com * @param context * @return */ public static Font deriveHeader1(Component context) { return context.getFont().deriveFont(Font.PLAIN, 16); }
From source file:Main.java
public static void setUpMenuEntries(JMenuItem item) { item.setMargin(new Insets(5, 20, 50, 20)); item.setFont(new Font(APP_FONT, Font.PLAIN, 20)); }
From source file:Main.java
public static int getFontSize(String text, boolean getWidth) { if (text != null && text.length() > 0) { Font defaultFont = new Font("Montserrat", Font.PLAIN, 13); AffineTransform affinetransform = new AffineTransform(); FontRenderContext frc = new FontRenderContext(affinetransform, true, true); int textWidth = (int) (defaultFont.getStringBounds(text, frc) != null ? defaultFont.getStringBounds(text, frc).getWidth() : 0) + 10;//from w ww . j a v a 2s.c o m int textHeight = (int) (defaultFont.getStringBounds(text, frc) != null ? defaultFont.getStringBounds(text, frc).getHeight() : 0); return getWidth ? textWidth : textHeight; } return 0; }
From source file:Main.java
public static void SetJTableAlignment(javax.swing.JTable jTable, ComponentOrientation componentOrientation) { Font tahoma = new Font("Tahoma", Font.PLAIN, 11); int labelAlighnment = JLabel.RIGHT; int headerAlighnment = JLabel.RIGHT; if (componentOrientation == ComponentOrientation.LEFT_TO_RIGHT) { labelAlighnment = JLabel.LEFT; headerAlighnment = JLabel.LEFT; }//from w w w .j a v a2 s. c o m DefaultTableCellRenderer defaultTableCellRenderer = new DefaultTableCellRenderer(); defaultTableCellRenderer.setHorizontalAlignment(labelAlighnment); // defaultTableCellRenderer.setFont(tahoma); for (int columnIndex = 0; columnIndex < jTable.getColumnCount(); columnIndex++) { if (jTable.getModel().getColumnClass(columnIndex).equals(Boolean.class)) { jTable.getColumnModel().getColumn(columnIndex).setWidth(60); jTable.getColumnModel().getColumn(columnIndex).setMaxWidth(90); jTable.getColumnModel().getColumn(columnIndex).setMinWidth(10); jTable.getColumnModel().getColumn(columnIndex).setPreferredWidth(60); continue; } if (jTable.getModel().getColumnClass(columnIndex).equals(ImageIcon.class)) { continue; } jTable.getColumnModel().getColumn(columnIndex).setCellRenderer(defaultTableCellRenderer); } DefaultTableCellRenderer renderer; renderer = (DefaultTableCellRenderer) jTable.getTableHeader().getDefaultRenderer(); renderer.setHorizontalAlignment(headerAlighnment); jTable.getTableHeader().setDefaultRenderer(renderer); }
From source file:Main.java
/** * Creates a new <code>JTextField</code> object with the given properties. * * @param bounds The position and dimension attributes * @return A <code>JTextField</code> object */// ww w . jav a 2 s . co m public static JTextField createJTextField(Rectangle bounds) { JTextField txtField = new JTextField(); txtField.setFont(new Font("Times New Roman", Font.PLAIN, 12)); txtField.setBounds(bounds); return txtField; }
From source file:Main.java
public static Font getFont() { return new Font("Arial", Font.PLAIN, 10); }
From source file:DataCharts.PieGraph.java
public static JFreeChart createChart(PieDataset dataset) { JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", dataset, true, true, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12)); plot.setNoDataMessage("Data Unavailable"); plot.setCircular(false);/*from www. ja v a 2 s. co m*/ plot.setLabelGap(0.01); plot.setBackgroundPaint(null); chart.setBorderPaint(null); chart.setBackgroundPaint(null); return chart; }