Java Code Examples for java.awt.Font

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project BMach, under directory /src/jsyntaxpane/actions/gui/.

Source file: MemberCell.java

  18 
vote

@Override public Dimension getPreferredSize(){
  Font font=list.getFont();
  Graphics g=getGraphics();
  FontMetrics fm=g.getFontMetrics(font);
  String total=getMemberName() + getArguments() + getReturnType()+ "  ";
  return new Dimension(fm.stringWidth(total) + 20,Math.max(fm.getHeight(),16));
}
 

Example 2

From project BoneJ, under directory /src/org/doube/geometry/.

Source file: Orienteer.java

  18 
vote

private void addLabels(){
  ImagePlus imp=WindowManager.getImage(activeImpID);
  scale=imp.getCanvas().getMagnification();
  Font font=new Font("SansSerif",Font.PLAIN,(int)(fontSize / scale));
  final double lsinTheta=(length + (fontSize / scale)) * Math.sin(theta);
  final double lcosTheta=(length + (fontSize / scale)) * Math.cos(theta);
  addString(directions[0],(int)(p.x + lsinTheta),(int)(p.y - lcosTheta),Color.RED,font);
  addString(directions[1],(int)(p.x - lsinTheta),(int)(p.y + lcosTheta),Color.BLUE,font);
  addString(directions[2],(int)(p.x + lcosTheta),(int)(p.y + lsinTheta),Color.BLUE,font);
  addString(directions[3],(int)(p.x - lcosTheta),(int)(p.y - lsinTheta),Color.BLUE,font);
}
 

Example 3

From project Briss, under directory /src/main/java/at/laborg/briss/model/.

Source file: ClusterImageData.java

  18 
vote

private static BufferedImage getUnrenderableImage(){
  int width=200;
  int height=200;
  BufferedImage bimage=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
  Graphics2D g2d=bimage.createGraphics();
  g2d.setColor(Color.WHITE);
  g2d.drawRect(5,5,190,190);
  Font font=new Font("Sansserif",Font.BOLD | Font.PLAIN,22);
  g2d.setFont(font);
  g2d.setColor(Color.WHITE);
  g2d.drawString("Image to Big!",10,110);
  g2d.dispose();
  return bimage;
}
 

Example 4

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/binding/internal/.

Source file: RangeEditor.java

  18 
vote

private static JLabel createSliderLabel(String text){
  JLabel label=new JLabel(text);
  Font oldFont=label.getFont();
  Font newFont=oldFont.deriveFont(oldFont.getSize2D() * 0.85f);
  label.setFont(newFont);
  return label;
}
 

Example 5

From project Clotho-Core, under directory /ClothoApps/PluginManager/src/org/clothocore/tool/pluginmanager/gui/.

Source file: ChoosePreferredViewers.java

  18 
vote

private void drawAvatarText(Graphics2D g2,double y,double bulletHeight){
  FontRenderContext context=g2.getFontRenderContext();
  Font font=new Font("Dialog",Font.PLAIN,18);
  TextLayout layout=new TextLayout(textAvatar,font,context);
  Rectangle2D bounds=layout.getBounds();
  float text_x=(float)((getWidth() - bounds.getWidth()) / 2.0);
  float text_y=(float)(y + (bulletHeight - layout.getAscent() - layout.getDescent()) / 2.0) + layout.getAscent() - layout.getLeading();
  g2.setColor(Color.BLACK);
  layout.draw(g2,text_x,text_y + 1);
  g2.setColor(Color.WHITE);
  layout.draw(g2,text_x,text_y);
}
 

Example 6

From project Custom-Salem, under directory /src/haven/.

Source file: RichText.java

  18 
vote

private LineMetrics lm(){
  if (lm == null) {
    Font f;
    if ((f=(Font)attrs.get(TextAttribute.FONT)) != null) {
    }
 else {
      f=new Font(attrs);
    }
    lm=f.getLineMetrics("",rs.frc);
  }
  return (lm);
}
 

Example 7

From project erjang, under directory /src/main/java/erjang/console/.

Source file: ERLConsole.java

  18 
vote

private Font findFont(String otherwise,int style,int size,String[] families){
  String[] fonts=GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
  Arrays.sort(fonts);
  Font font=null;
  for (int i=0; i < families.length; i++) {
    if (Arrays.binarySearch(fonts,families[i]) >= 0) {
      font=new Font(families[i],style,size);
      break;
    }
  }
  if (font == null)   font=new Font(otherwise,style,size);
  return font;
}
 

Example 8

From project fastjson, under directory /src/test/java/com/alibaba/json/bvt/.

Source file: FontTest.java

  18 
vote

public void test_color() throws Exception {
  Font[] fonts=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
  for (  Font font : fonts) {
    String text=JSON.toJSONString(font);
    Font font2=JSON.parseObject(text,Font.class);
    Assert.assertEquals(font,font2);
  }
}
 

Example 9

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/form/.

Source file: SelectField.java

  18 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  NameValuePair pair=(NameValuePair)value;
  if (pair != null && pair.getValue() == null) {
    super.getListCellRendererComponent(list,value,index,false,false);
    Font fold=getFont();
    Font fnew=new Font(fold.getName(),Font.BOLD | Font.ITALIC,fold.getSize());
    setFont(fnew);
  }
 else {
    super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  }
  return this;
}
 

Example 10

From project freemind, under directory /freemind/freemind/view/mindmapview/attributeview/.

Source file: AttributeTable.java

  18 
vote

private void updateFontSize(Component c,float zoom){
  Font font=c.getFont();
  if (font != null) {
    float oldFontSize=font.getSize2D();
    float newFontSize=getFontSize() * zoom;
    if (oldFontSize != newFontSize) {
      font=font.deriveFont(newFontSize);
      c.setFont(font);
    }
  }
}
 

Example 11

From project gitblit, under directory /src/com/gitblit/client/.

Source file: MessageRenderer.java

  18 
vote

private JLabel newRefLabel(){
  JLabel label=new JLabel();
  label.setOpaque(true);
  Font font=label.getFont();
  label.setFont(font.deriveFont(font.getSize2D() - 1f));
  return label;
}
 

Example 12

From project gs-core, under directory /src/org/graphstream/ui/swingViewer/util/.

Source file: FontCache.java

  18 
vote

protected Font insert(Map<Integer,Font> map,int style,int size){
  Font font=map.get(size);
  if (font == null) {
    font=new Font(name,style,size);
    map.put(size,font);
  }
  return font;
}
 

Example 13

From project Agot-Java, under directory /src/main/java/got/ui/.

Source file: InfoStatusDialog.java

  17 
vote

private void layoutCoponents(){
  this.setLayout(null);
  infoPane.setText(info);
  infoPane.setFont(new Font("Arial Black",Font.ITALIC,13));
  infoPane.setLocation(130,3);
  infoPane.setSize(700,20);
  infoPane.setOpaque(false);
  infoPane.setForeground(Color.white);
  panel.setLocation(0,0);
  panel.setSize(960,50);
  panel.add(infoPane);
  panel.setLayout(null);
  this.add(panel);
}
 

Example 14

From project alg-vis, under directory /src/algvis/gui/.

Source file: Commentary.java

  17 
vote

public Commentary(VisPanel V,JScrollPane sp){
  super();
  this.V=V;
  setContentType("text/html; charset=iso-8859-2");
  setEditable(false);
  Font font=UIManager.getFont("Label.font");
  StyleSheet css=((HTMLDocument)getDocument()).getStyleSheet();
  css.addRule("body { font-family: " + font.getFamily() + "; "+ "font-size: 12pt; margin: 10pt; margin-top: 0pt; "+ "}");
  css.addRule(".step { margin-bottom: 5pt; }");
  css.addRule("ol { padding-left: 14px; margin: 0px; }");
  css.addRule("a { color: black; text-decoration:none; }");
  css.addRule("p.note { font-style: italic; margin: 0pt; margin-bottom: 5pt; }");
  this.sp=sp;
  Languages.addListener(this);
  addHyperlinkListener(this);
  setText("<html><body></body></html>");
}
 

Example 15

From project Carolina-Digital-Repository, under directory /djatoka-cdr/src/gov/lanl/adore/djatoka/plugin/.

Source file: TextWatermark.java

  17 
vote

/** 
 * Performs the transformation based on the provided global and instance properties.
 * @param bi the extracted region BufferedImage to be transformed
 * @return the resulting BufferedImage or the same bi if no changes are made
 * @throws TransformException
 */
public BufferedImage run(BufferedImage bi) throws TransformException {
  if (!isTransformable())   return bi;
  Graphics2D graphics=bi.createGraphics();
  graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,fontOpacity));
  graphics.setColor(color);
  graphics.setFont(new Font(fontName,Font.PLAIN,fontSize));
  graphics.drawString(msg,10,bi.getHeight() - 10);
  return bi;
}
 

Example 16

From project chukwa, under directory /src/main/java/org/apache/hadoop/chukwa/analysis/salsa/visualization/.

Source file: Heatmap.java

  17 
vote

/** 
 * Generates image in specified format, and writes image as binary output to supplied output stream 
 */
public boolean getImage(java.io.OutputStream output,String img_fmt,double scale){
  dis=new Display(this.viz);
  dis.setSize(SIZE_X,SIZE_Y);
  dis.setHighQuality(true);
  dis.setFont(new Font(Font.SANS_SERIF,Font.PLAIN,24));
  return dis.saveImage(output,img_fmt,scale);
}
 

Example 17

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/.

Source file: NewExecutionListLauncherWindow.java

  17 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  JLabel jLabel=(JLabel)renderer.getListCellRendererComponent(list,getRendererValue(value),index,isSelected,cellHasFocus);
  jLabel.setFont(new Font(jLabel.getFont().getFontName(),Font.PLAIN,jLabel.getFont().getSize()));
  ResultTreatmentGui resultTreatmentGui=(ResultTreatmentGui)value;
  resultTreatmentGui.customizeTitle(jLabel);
  return jLabel;
}
 

Example 18

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: DefaultImageView.java

  17 
vote

public void paint(Graphics g){
  if ((colors == null) && (pixelData == null)) {
    return;
  }
  Font font=g.getFont();
  g.setFont(new Font(font.getName(),font.getStyle(),12));
  for (int i=0; i < 256; i++) {
    g.setColor(colors[i]);
    g.fillRect(0,paintSize.height * i,paintSize.width,paintSize.height);
  }
  g.setColor(Color.black);
  for (int i=0; i < 25; i++) {
    g.drawString(format.format(pixelData[i * 10]),paintSize.width + 5,10 + paintSize.height * i * 10);
  }
  g.drawString(format.format(pixelData[255]),paintSize.width + 5,paintSize.height * 255);
}
 

Example 19

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/.

Source file: LogBrokerMonitor.java

  17 
vote

protected JTextArea createDetailTextArea(){
  JTextArea detailTA=new JTextArea();
  detailTA.setFont(new Font("Monospaced",Font.PLAIN,14));
  detailTA.setTabSize(3);
  detailTA.setLineWrap(true);
  detailTA.setWrapStyleWord(false);
  return (detailTA);
}
 

Example 20

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/util/.

Source file: EncogFonts.java

  17 
vote

private EncogFonts(){
  this.codeFont=new Font("monospaced",0,12);
  this.bodyFont=new Font("serif",0,12);
  this.headFont=new Font("serif",Font.BOLD,12);
  this.titleFont=new Font("serif",Font.BOLD,16);
}
 

Example 21

From project engine, under directory /main/com/midtro/platform/modules/assets/types/.

Source file: FontAssembler.java

  17 
vote

/** 
 * {@inheritDoc}
 */
@Override public void assemble(String assetName,String fileName,AssetConfig config,Map<String,Asset<?>> store) throws Exception {
  Font font=null;
switch (config.getMountType()) {
case FILE:
    font=Font.createFont(Font.TRUETYPE_FONT,new File(config.getFileLocation() + fileName.replace('/',File.separatorChar)));
  break;
case CACHE:
font=Font.createFont(Font.TRUETYPE_FONT,new File(config.getCacheLocation() + fileName.replace('/',File.separatorChar)));
break;
case URL:
font=Font.createFont(Font.TRUETYPE_FONT,new URL(config.getUrlLocation() + fileName).openStream());
break;
default :
throw new IllegalStateException("Unknown mount type");
}
store.put("font." + assetName,new FontAsset(assetName,font));
}
 

Example 22

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/view/components/.

Source file: JToggleButtonForPanel.java

  17 
vote

public JToggleButtonForPanel(){
  super();
  setLayout(null);
  setIcon(createImageIcon("/res/images/arrow_down.png","Open"));
  setSelectedIcon(createImageIcon("/res/images/arrow_right.png","Close"));
  setBorderPainted(false);
  setBackground(Color.WHITE);
  setForeground(Color.BLACK);
  setFont(new Font("Dialog",Font.PLAIN,13));
  setText("Panel Button");
  setSize(250,30);
  setPreferredSize(getSize());
}
 

Example 23

From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/generic_node/.

Source file: GenericKnimeNodeView.java

  17 
vote

private JScrollPane createScrollableOutputArea(final String content){
  JTextArea text=new JTextArea(content,40,80);
  text.setFont(new Font("Monospaced",Font.BOLD,12));
  text.setEditable(false);
  if (content.length() == 0) {
    text.setEnabled(false);
  }
  JScrollPane scrollpane=new JScrollPane(text);
  return scrollpane;
}
 

Example 24

From project GeoBI, under directory /webapp/src/main/java/com/c2c/controller/.

Source file: GetBaseLayer.java

  17 
vote

private void renderMap(HttpServletResponse response,FeatureCollection feat,ReferencedEnvelope bounds,Rectangle imageSize,String format) throws IOException {
  MapLayer[] layers={new MapLayer(feat,baseStyle)};
  MapContext map=new DefaultMapContext(layers,bounds.getCoordinateReferenceSystem());
  try {
    GTRenderer renderer=new StreamingRenderer();
    renderer.setContext(map);
    BufferedImage image=new BufferedImage(imageSize.width,imageSize.height,BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics=image.createGraphics();
    graphics.setBackground(new Color(0xd6e4f1));
    graphics.clearRect(0,0,imageSize.width,imageSize.height);
    try {
      if (feat.getSchema().getGeometryDescriptor() == null) {
        graphics.setColor(Color.BLACK);
        int y=imageSize.height / 2;
        Font font=new Font(Font.SERIF,Font.BOLD,14);
        graphics.setFont(font);
        graphics.drawString("Results have no geometries",10,y - 14);
      }
 else {
        renderer.paint(graphics,imageSize,bounds);
      }
      ServletOutputStream output=response.getOutputStream();
      try {
        ImageIO.write(image,format,output);
      }
  finally {
        output.close();
      }
    }
  finally {
      graphics.dispose();
    }
  }
  finally {
    map.dispose();
  }
}
 

Example 25

From project GraduationProject, under directory /tesseract-android-tools/external/tesseract-3.00/java/com/google/scrollview/ui/.

Source file: SVWindow.java

  17 
vote

/** 
 * Draw some text at (x,y) using the current pen color and text attributes. If the current font does NOT support at least one character, it tries to find a font which is capable of displaying it and use that to render the text. Note: If the font says it can render a glyph, but in reality it turns out to be crap, there is nothing we can do about it.
 */
public void drawText(int x,int y,String text){
  int unreadableCharAt=-1;
  char[] chars=text.toCharArray();
  PText pt=new PText(text);
  pt.setTextPaint(currentPenColor);
  pt.setFont(currentFont);
  for (int i=0; i < chars.length; i++) {
    if (!currentFont.canDisplay(chars[i])) {
      unreadableCharAt=i;
      break;
    }
  }
  if (unreadableCharAt != -1) {
    Font[] allfonts=GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
    for (int j=0; j < allfonts.length; j++) {
      if (allfonts[j].canDisplay(chars[unreadableCharAt])) {
        Font tempFont=new Font(allfonts[j].getFontName(),currentFont.getStyle(),currentFont.getSize());
        pt.setFont(tempFont);
        break;
      }
    }
  }
  pt.setX(x);
  pt.setY(y);
  layer.addChild(pt);
}
 

Example 26

From project groovejaar, under directory /src/groovejaar/.

Source file: Disclaimer.java

  17 
vote

/** 
 * Create the dialog.
 */
public Disclaimer(){
  setTitle("Disclaimer");
  this.setIconImage(new ImageUtil().getLogo());
  setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  setBounds(100,100,450,300);
  JLabel lblGroovejaarIs=new JLabel("<html>\r\n1. GrooveJaar is a software that have the intent to expand the GrooveShark functions.<br/>\r\n2. Some mp3 filescannot be legally downloaded for free. GrooveJaar does not allow establishing the legal consequences of downloading this or that file.<br/>\r\n3.  All musical tracks presented are only for trying and fact-finding listening. It is your obligation to remove all downloaded mp3 files from your computer after listening and purchase a legal copy from the copyright holder.<br/>\r\n4. Not doing so may be in conflict with the copyright protection laws in effect in your country of residence. GrooveJaar bears no responsibility for any legal consequences.<br/>\r\n5. All musical tracks are the legal property of their respective owners. All copyrights, \r\ndistribution rights and other rights belong to their respective owners.<br/>\r\n6. Using this software indicates your agreement to be bound by our Disclaimer.\r\n</html>");
  lblGroovejaarIs.setFont(new Font("Tahoma",Font.BOLD | Font.ITALIC,11));
  GroupLayout groupLayout=new GroupLayout(getContentPane());
  groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(lblGroovejaarIs,GroupLayout.DEFAULT_SIZE,414,Short.MAX_VALUE).addContainerGap()));
  groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(lblGroovejaarIs,GroupLayout.DEFAULT_SIZE,240,Short.MAX_VALUE).addContainerGap()));
  getContentPane().setLayout(groupLayout);
}
 

Example 27

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/graph2d/.

Source file: Spectrum2DDisplay.java

  16 
vote

public Graph2D makeGraph(){
  Graph2D graph;
  DataSet data1;
  Axis xaxis;
  Axis yaxis_left;
  int i;
  int j;
  List<CMLPeak> peaks=spectrum.getPeakListElements().get(0).getPeakChildren();
  double data[]=new double[2 * peaks.size()];
  graph=new Graph2D();
  graph.drawzero=false;
  graph.drawgrid=false;
  graph.setDataBackground(Color.WHITE);
  graph.setGraphBackground(Color.WHITE);
  try {
    graph.setMarkers(new Markers());
  }
 catch (  Exception e) {
    System.out.println("Failed to create Marker URL!");
  }
  for (i=j=0; i < peaks.size(); i++, j+=2) {
    data[j]=peaks.get(i).getXValue();
    data[j + 1]=peaks.get(i).getYValue();
  }
  data1=graph.loadDataSet(data,peaks.size());
  data1.linestyle=0;
  data1.marker=1;
  data1.markerscale=1.5;
  data1.markercolor=new Color(0,0,255);
  xaxis=graph.createAxis(Axis.BOTTOM);
  xaxis.attachDataSet(data1);
  xaxis.setTitleFont(new Font("TimesRoman",Font.PLAIN,20));
  xaxis.setLabelFont(new Font("Helvetica",Font.PLAIN,15));
  yaxis_left=graph.createAxis(Axis.LEFT);
  yaxis_left.attachDataSet(data1);
  yaxis_left.setTitleFont(new Font("TimesRoman",Font.PLAIN,20));
  yaxis_left.setLabelFont(new Font("Helvetica",Font.PLAIN,15));
  yaxis_left.setTitleColor(new Color(0,0,255));
  return graph;
}
 

Example 28

From project blogs, under directory /request-mappers/src/main/java/com/wicketinaction/requestmappers/resources/images/.

Source file: ImageResourceReference.java

  16 
vote

/** 
 * Generates an image with a label. For real life application this method will read the image bytes from  external source.
 * @param label the image text to render
 * @return
 */
private byte[] getImageAsBytes(String label){
  BufferedImage image=new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
  Graphics2D g=(Graphics2D)image.getGraphics();
  g.setColor(Color.BLACK);
  g.setBackground(Color.WHITE);
  g.clearRect(0,0,image.getWidth(),image.getHeight());
  g.setFont(new Font("SansSerif",Font.PLAIN,48));
  g.drawString(label,50,50);
  g.dispose();
  Iterator<ImageWriter> writers=ImageIO.getImageWritersByFormatName("jpg");
  ImageWriter writer=writers.next();
  if (writer == null) {
    throw new RuntimeException("JPG not supported?!");
  }
  final ByteArrayOutputStream out=new ByteArrayOutputStream();
  byte[] imageBytes=null;
  try {
    ImageOutputStream imageOut=ImageIO.createImageOutputStream(out);
    writer.setOutput(imageOut);
    writer.write(image);
    imageOut.close();
    imageBytes=out.toByteArray();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return imageBytes;
}
 

Example 29

From project Chess_1, under directory /src/chess/gui/.

Source file: DefaultDisplay.java

  16 
vote

/** 
 * Paint a horizontally and vertically-centered text string.
 * @param g2 drawing surface
 * @param s string to draw (centered)
 * @param rect the bounding rectangle
 * @param fontHeight the desired height of the font. (The font will beshrunk in increments of sqrt(2)/2 if the text is too large.)
 * @param color the color in which to draw the text
 */
protected void paintCenteredText(Graphics2D g2,String s,Rectangle rect,double fontHeight,Color color){
  g2=(Graphics2D)g2.create();
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  g2.setPaint(color);
  Rectangle2D bounds=null;
  LineMetrics lm=null;
  boolean done=false;
  while (!done) {
    g2.setFont(new Font("SansSerif",Font.BOLD,(int)(fontHeight * rect.height)));
    FontRenderContext frc=g2.getFontRenderContext();
    bounds=g2.getFont().getStringBounds(s,frc);
    if (bounds.getWidth() > rect.getWidth())     fontHeight=fontHeight * Math.sqrt(2) / 2;
 else {
      done=true;
      lm=g2.getFont().getLineMetrics(s,frc);
    }
  }
  float centerX=rect.x + rect.width / 2;
  float centerY=rect.y + rect.height / 2;
  float leftX=centerX - (float)bounds.getWidth() / 2;
  float baselineY=centerY - lm.getHeight() / 2 + lm.getAscent();
  g2.drawString(s,leftX,baselineY);
  g2.dispose();
}
 

Example 30

From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/.

Source file: FieldLabelWindow.java

  16 
vote

/** 
 * Init GUI.
 * @exception SQLException Description of Exception
 * @exception PersistenceException Description of Exception
 */
private void jbInit() throws SQLException, PersistenceException {
  fieldLabelTable=new GenericTable(tableHome.getTable("PM_FIELD_LABEL"),true);
  setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
  getContentPane().setLayout(new BorderLayout(0,0));
  topPanel.setLayout(new FlowLayout(FlowLayout.LEFT,5,5));
  titleLabel.setText("Visualisation des donn?s : " + fieldLabelTable.getNumberOfFirstRow() + "  "+ fieldLabelTable.getNumberOfLastRow()+ " sur "+ fieldLabelTable.getNumberOfRows()+ " enregistrements");
  titleLabel.setFont(new Font("Dialog",Font.BOLD,12));
  topPanel.add(titleLabel);
  fieldLabelTable.getModel().addTableModelListener(new TableModelListener(){
    /** 
 * DOCUMENT ME!
 * @param evt Description of Parameter
 */
    public void tableChanged(    javax.swing.event.TableModelEvent evt){
      titleLabel.setText("Visualisation des donn?s : " + fieldLabelTable.getNumberOfFirstRow() + "  "+ fieldLabelTable.getNumberOfLastRow()+ " sur "+ fieldLabelTable.getNumberOfRows()+ " enregistrements");
    }
  }
);
  tableScrollPane.setBorder(BorderFactory.createEtchedBorder());
  fieldLabelTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
  tableScrollPane.getViewport().add(fieldLabelTable);
  bottomToolBar=new PersistentToolBar(gexPane,fieldLabelTable,this,"net.codjo.gui");
  getContentPane().add(topPanel,BorderLayout.NORTH);
  getContentPane().add(tableScrollPane,BorderLayout.CENTER);
  getContentPane().add(bottomToolBar,BorderLayout.SOUTH);
  setSize(726,550);
}
 

Example 31

From project FinallyLord, under directory /src/render/ui/.

Source file: MessageBox.java

  16 
vote

public MessageBox(float scale){
  log=new ArrayList<String>();
  this.scale=scale;
  maxchar=105;
  try {
    sheet=new SpriteSheet("data/img/lofi_font_big_ascii_color.png",8,8);
    font=new SpriteSheetFont(sheet,' ');
    jFont=new Font("sansserif",Font.BOLD,15);
    uFont=new UnicodeFont(jFont);
    uFont.addAsciiGlyphs();
    uFont.addGlyphs(400,600);
    uFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
    uFont.loadGlyphs();
  }
 catch (  SlickException e) {
    e.printStackTrace();
  }
  addText("This is a really long string that maybe one day will be automatically split but maybe not who knows. It turns out this string does get split which is pretty awesome considering the circumstances.");
  Log.setBox(this);
}
 

Example 32

From project formic, under directory /src/java/org/formic/wizard/impl/gui/.

Source file: GuiWizardStep.java

  16 
vote

/** 
 * {@inheritDoc}
 * @see PanelWizardStep#setBusy(boolean)
 */
public void setBusy(boolean busy){
  super.setBusy(busy);
  Container grandparent=getParent().getParent().getParent();
  Container parent=getParent().getParent();
  if (step.isBusyAnimated()) {
    if (busy) {
      if (infiniteProgress == null) {
        infiniteProgress=new SingleComponentInfiniteProgress(false);
        infiniteProgress.setFont(new Font(null,Font.BOLD,15));
        grandparent.remove(parent);
        MGlassPaneContainer container=new MGlassPaneContainer(parent);
        grandparent.add(container,BorderLayout.CENTER);
        container.setGlassPane(infiniteProgress);
        String busyText=Installer.getString(step.getName() + ".busy");
        infiniteProgress.setText(busyText != null ? busyText : BUSY_TEXT);
      }
      infiniteProgress.setVisible(true);
    }
 else {
      if (infiniteProgress != null) {
        infiniteProgress.setVisible(false);
      }
    }
  }
}
 

Example 33

From project AceWiki, under directory /src/ch/uzh/ifi/attempto/acewiki/gui/.

Source file: IndexBar.java

  15 
vote

private IndexBar(String text){
  Row mainRow=new Row();
  mainRow.setInsets(new Insets(10,2,5,2));
  mainRow.setCellSpacing(new Extent(5));
  mainRow.add(new SolidLabel(text,Font.ITALIC,10));
  row=new Row();
  mainRow.add(row);
  add(mainRow);
}
 

Example 34

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/renderer/.

Source file: CategoryComboboxRenderer.java

  15 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  boolean postprocess=false;
  if (value instanceof ChoiceNode) {
    postprocess=true;
    String property=StringUtils.lowerCase(value.toString());
    if (d_alternate) {
      value="Consider " + property;
    }
 else {
      value="Consider " + property + " first";
    }
  }
  Component c=d_defaultRenderer.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (postprocess || value instanceof CategorySpecifiers || (value instanceof LeafNode && value.toString().equals(LeafNode.NAME_EXCLUDE))) {
    c.setFont(c.getFont().deriveFont(Font.BOLD));
  }
  return c;
}
 

Example 35

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/directorytree/.

Source file: ShowDetailActionVisitor.java

  15 
vote

@Override public List<? extends Action> visit(final Image img){
  final String title="Image Details";
  return Collections.singletonList(new AbstractAction(title){
    @Override public void actionPerformed(    ActionEvent e){
      Logger.noteAction(ShowDetailActionVisitor.class);
      final JFrame frame=new JFrame(title);
      final JDialog popUpWindow=new JDialog(frame,title,true);
      Dimension screenDimension=Toolkit.getDefaultToolkit().getScreenSize();
      popUpWindow.setSize(750,400);
      int w=popUpWindow.getSize().width;
      int h=popUpWindow.getSize().height;
      popUpWindow.setLocation((screenDimension.width - w) / 2,(screenDimension.height - h) / 2);
      ImageDetailsPanel imgDetailPanel=new ImageDetailsPanel();
      Boolean counter=false;
      imgDetailPanel.setImgNameValue(img.getName());
      imgDetailPanel.setImgTypeValue(Image.imageTypeToString(img.getType()));
      imgDetailPanel.setImgSectorSizeValue(Long.toString(img.getSsize()));
      counter=true;
      if (counter) {
        popUpWindow.add(imgDetailPanel);
      }
 else {
        JLabel error=new JLabel("Error: No Volume Matches.");
        error.setFont(new Font("Arial",Font.BOLD,24));
        popUpWindow.add(error);
      }
      imgDetailPanel.setOKButtonActionListener(new ActionListener(){
        @Override public void actionPerformed(        ActionEvent e){
          popUpWindow.dispose();
        }
      }
);
      popUpWindow.pack();
      popUpWindow.setResizable(false);
      popUpWindow.setVisible(true);
    }
  }
);
}
 

Example 36

From project Calendar-Application, under directory /calendar/.

Source file: ContactPanel.java

  15 
vote

public ContactPanel(AddressBookPanel parent){
  setOpaque(false);
  setFont(new FontUIResource(new Font("Arial",Font.PLAIN,10)));
  m_parent=parent;
  setBorder(new EtchedBorder());
  URL iconURL=getClass().getResource("/images/contact2.png");
  m_icon=new JLabel(new ImageIcon(iconURL));
  m_icon.setPreferredSize(new Dimension(50,50));
  m_name_field=new JTextField(5);
  m_dob_field=new JDateChooser();
  m_website_field=new JTextField(5);
  m_landphone_field=new JTextField(5);
  m_mobilephone_field=new JTextField(5);
  m_workphone_field=new JTextField(5);
  m_email_field=new JTextField(5);
  m_workemail_field=new JTextField(5);
  m_add_button=new JButton("Add");
  m_add_button.setIcon(new ImageIcon(getClass().getResource("/images/add_20.png")));
  ;
  m_add_button.addActionListener(this);
  m_contact=new Contact();
  initView();
  m_mode=ContactPanel.ADD_MODE;
  renderAdd(false);
}
 

Example 37

From project CraftMania, under directory /CraftMania/src/org/craftmania/game/.

Source file: FontStorage.java

  15 
vote

public static GLFont loadFont(String id,InputStream in,float size) throws IOException {
  try {
    GLFont font=new GLFont(Font.createFont(Font.TRUETYPE_FONT,in).deriveFont(size));
    map.put(id,font);
    return font;
  }
 catch (  FontFormatException ex) {
    Logger.getLogger(FontStorage.class.getName()).log(Level.SEVERE,null,ex);
  }
  return null;
}
 

Example 38

From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.

Source file: JCalendar.java

  15 
vote

/** 
 * Sets the font property.
 * @param font the new font
 */
public void setFont(Font font){
  super.setFont(font);
  if (dayChooser != null) {
    dayChooser.setFont(font);
    monthChooser.setFont(font);
    yearChooser.setFont(font);
  }
}
 

Example 39

From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/broker/ui/.

Source file: ScrollingBanner.java

  15 
vote

public ScrollingBanner(){
  super();
  ticks=new ConcurrentLinkedQueue<StockTick>();
  setBackground(Color.BLACK);
  setForeground(Color.GREEN);
  setFont(new JTextField().getFont().deriveFont(Font.BOLD));
  setPreferredSize(new Dimension(500,20));
}
 

Example 40

From project glg2d, under directory /src/main/java/glg2d/impl/gl2/.

Source file: GL2StringDrawer.java

  15 
vote

public TextRenderer getRenderer(Font font,boolean antiAlias){
  TextRenderer[] renderers=get(font);
  if (renderers == null) {
    renderers=new TextRenderer[2];
    put(font,renderers);
  }
  TextRenderer renderer=renderers[antiAlias ? 1 : 0];
  if (renderer == null) {
    renderer=new TextRenderer(font,antiAlias,false);
    renderers[antiAlias ? 1 : 0]=renderer;
  }
  return renderer;
}
 

Example 41

From project gridland, under directory /src/org/grid/server/.

Source file: ClientsPanel.java

  15 
vote

public TeamPanel(Team team){
  this.team=team;
  Color color=team.getColor();
  double gray=0.2989 * color.getRed() + 0.5870 * color.getGreen() + 0.1140 * color.getBlue();
  header.setBackground(gray > 128 ? Color.DARK_GRAY : Color.WHITE);
  setLayout(new BorderLayout());
  header.setBorder(BorderFactory.createEmptyBorder(2,5,2,5));
  header.setLayout(new BorderLayout(4,4));
  title=new JLabel(team.getName());
  title.setForeground(color);
  title.setFont(getFont().deriveFont(Font.BOLD,14));
  title.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
  score.setOpaque(false);
  score.setForeground(color);
  score.setFont(getFont().deriveFont(Font.BOLD,14));
  score.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
  score.setHorizontalAlignment(JLabel.RIGHT);
  header.add(title,BorderLayout.CENTER);
  header.add(score,BorderLayout.EAST);
  add(header,BorderLayout.NORTH);
  add(new JScrollPane(clientPanel),BorderLayout.CENTER);
  team.addListener(this);
}