List of usage examples for java.awt Font DIALOG
String DIALOG
To view the source code for java.awt Font DIALOG.
Click Source Link
From source file:knop.psfj.heatmap.HeatMapGenerator.java
/** * Plot columns.//from w ww.ja va 2 s . co m * * @param xColumn the x column * @param yColumn the y column * @param width the width * @param height the height * @return the image processor */ public ImageProcessor plotColumns(String xColumn, String yColumn, int width, int height) { // sorting the value ArrayList<KnPoint> pointList = new ArrayList<KnPoint>(); for (int i = 0; i != getColumnSize(); i++) { pointList.add(new KnPoint(dataSet.getDoubleValue(xColumn, i), dataSet.getDoubleValue(yColumn, i))); } Collections.sort(pointList); // putting the value in arrays of double double[] x = new double[pointList.size()]; double[] y = new double[pointList.size()]; for (int i = 0; i != pointList.size(); i++) { KnPoint k = pointList.get(i); x[i] = k.x; y[i] = k.y; } String unit = getColumnUnit(yColumn); double max = getPlotMax(); double min = getPlotMin(); double line = getPlotLine(); double xLimitMin; double xLimitMax; double half; double coeff; if (xColumn.contains("y")) { half = 1.0 * calibration.pixelHeight * imageHeight / 2; coeff = 1; } else { half = 1.0 * calibration.pixelWidth * imageWidth / 2; coeff = 1; } xLimitMin = -1.0 * coeff * half; xLimitMax = coeff * half; double[] thLineX = new double[] { xLimitMin, xLimitMax }; double[] thLineY = new double[] { line, line }; //double[] thLine = new double[y.length]; /* for (int i = 0; i != thLine.length; i++) { thLine[i] = line; } */ String xLabel = getColumnName(xColumn) + (getColumnUnit(xColumn).equals("") ? "" : " (" + getColumnUnit(xColumn) + ")"); String yLabel = getColumnName(yColumn) + (getColumnUnit(yColumn).equals("") ? "" : " (" + getColumnUnit(yColumn) + ")"); Plot p = new Plot("", xLabel, yLabel); p.setSize(width, height); p.setXLabelFont(new java.awt.Font(Font.DIALOG, Font.PLAIN, height / 16)); p.setYLabelFont(new java.awt.Font(Font.DIALOG, Font.PLAIN, height / 16)); // Plot p = new Plot("", getColumnName(xColumn) + " (m)", //getColumnName(yColumn) + " " + unit, x, y); //Plot p = new Plot("", getColumnName(xColumn) + " (" // + getColumnUnit(xColumn) + ")", //getColumnName(yColumn) + " " + unit, x, y); //p.setColor(Color.black); //p.addPoints(x, y, Plot.LINE); //p.setColor(Color.blue); // p.setFont(new java.awt.Font("Default",18,Font.NORMAL)); if (x.length > 0) p.setLimits(xLimitMin, xLimitMax, min, max); p.setColor(Color.red); p.setLineWidth(1); p.addPoints(thLineX, thLineY, Plot.LINE); p.setColor(Color.blue); p.setLineWidth(1); p.addPoints(x, y, Plot.LINE); return p.getProcessor(); }
From source file:com.igormaznitsa.mindmap.swing.panel.MindMapPanel.java
private static void drawErrorText(final Graphics2D gfx, final Dimension fullSize, final String error) { final Font font = new Font(Font.DIALOG, Font.BOLD, 24); final FontMetrics metrics = gfx.getFontMetrics(font); final Rectangle2D textBounds = metrics.getStringBounds(error, gfx); gfx.setFont(font);/*from ww w . j a v a 2s . c om*/ gfx.setColor(Color.DARK_GRAY); gfx.fillRect(0, 0, fullSize.width, fullSize.height); final int x = (int) (fullSize.width - textBounds.getWidth()) / 2; final int y = (int) (fullSize.height - textBounds.getHeight()) / 2; gfx.setColor(Color.BLACK); gfx.drawString(error, x + 5, y + 5); gfx.setColor(Color.RED.brighter()); gfx.drawString(error, x, y); }
From source file:org.biojava.bio.view.MotifAnalyzer.java
private JPanel getStatisticsTab(int excelNum) throws IOException { JPanel panel = new JPanel(); GroupLayout panelLayout = new GroupLayout((JComponent) panel); panel.setLayout(panelLayout);//w ww . j a va 2 s. c o m panel.setPreferredSize(new java.awt.Dimension(676, 557)); Object[][] tableData = FileConverterTools.readExcel(FileNames.getStatisticsExcelFileName(excelNum)); Object columnName[] = new Object[tableData[0].length]; for (int i = 0; i < columnName.length; i++) columnName[i] = i; tableData = null; //free memory final JTable table = new JTable(); JScrollPane jScrollPane = new JScrollPane(table); table.setFont(new Font(Font.DIALOG, Font.BOLD, 15)); table.setEnabled(false); File file = new File(FileNames.getStatisticsExcelFileName(excelNum)); JTableReadTableModelTask task = new JTableReadTableModelTask(file, null, null, table); task.execute(); JButton button = new JButton("Save to Excel"); panelLayout.setVerticalGroup(panelLayout.createSequentialGroup() .addComponent(jScrollPane, GroupLayout.PREFERRED_SIZE, 485, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(button, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40)); panelLayout.setHorizontalGroup(panelLayout.createParallelGroup() .addComponent(jScrollPane, GroupLayout.Alignment.LEADING, 0, 676, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.LEADING, panelLayout.createSequentialGroup().addGap(0, 493, Short.MAX_VALUE) .addComponent(button, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE) .addContainerGap(40, 40))); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(MotifAnalyzer.this.mainFrame); if (returnVal == JFileChooser.APPROVE_OPTION) { try { //File file = new File(fc.getSelectedFile().getCanonicalPath()); //JTableWriteTableModelTask task = new JTableWriteTableModelTask(file, null, null, table); //task.execute(); } catch (Exception e) { e.printStackTrace(); } } } }); return panel; }
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 w ww . j a va 2 s . c om 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; }