Java Code Examples for java.awt.Graphics2D#getRenderingHints()

The following examples show how to use java.awt.Graphics2D#getRenderingHints() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KwikiDateSensitivityPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param g2d
 */
public void paint(Graphics2D g2d) {

    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);
    g2d.setColor(Color.BLACK);

    double rangeX = (getMaxX() - getMinX());
    double rangeY = (getMaxY() - getMinY());

    DrawBounds(g2d);
    DrawAxesAndTicks(g2d, rangeX, rangeY);
    DrawDates(g2d, rangeX, rangeY);

}
 
Example 2
Source File: KwikiDateDisplayPanel.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 * 
 * @param g2d
 */
public void paint ( Graphics2D g2d ) {

    RenderingHints rh = g2d.getRenderingHints();
    rh.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
    rh.put( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
    g2d.setRenderingHints( rh );
    g2d.setColor( Color.BLACK );

    double rangeX = (getMaxX() - getMinX());
    double rangeY = (getMaxY() - getMinY());

    DrawBounds( g2d );
    DrawDateNames( getChangedDates(), g2d, rangeX, rangeY );

}
 
Example 3
Source File: JPanelActiveBox.java    From jclic with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  RenderingHints rh = g2.getRenderingHints();
  g2.setRenderingHints(Constants.DEFAULT_RENDERING_HINTS);

  if (ab == null) {
    super.paintComponent(g2);
  } else {
    while (true) {
      BoxBase.flagFontReduced = false;
      ab.update(g2, g2.getClipBounds(), io);
      if (!BoxBase.flagFontReduced)
        break;
    }
  }
  g2.setRenderingHints(rh);
}
 
Example 4
Source File: AbstractDataView.java    From ET_Redux with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param g2d
 */
protected void paintInit(Graphics2D g2d) {
    g2d.setClip(leftMargin, topMargin, (int) graphWidth, (int) graphHeight);
    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    g2d.setPaint(Color.BLACK);
    g2d.setStroke(new BasicStroke(1.0f));
    g2d.setFont(new Font(
            "SansSerif",
            Font.BOLD,
            10));

}
 
Example 5
Source File: Plot2D.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void drawPoint(Graphics2D g, PointShape aPS, PointBreak aPB, Rectangle2D area) {
    PointD p = aPS.getPoint();
    double[] sXY = projToScreen(p.X, p.Y, area);
    PointF pf = new PointF((float) sXY[0], (float) sXY[1]);
    RenderingHints rend = g.getRenderingHints();
    boolean rc = false;
    if (this.symbolAntialias && rend.get(RenderingHints.KEY_ANTIALIASING) != RenderingHints.VALUE_ANTIALIAS_ON) {
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        rc = true;
    }
    Draw.drawPoint(pf, aPB, g);
    if (rc){
        g.setRenderingHints(rend);
    }
}
 
Example 6
Source File: JigSawEditorPanel.java    From jclic with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
  super.paintComponent(g);
  Graphics2D g2 = (Graphics2D) g;
  RenderingHints rh = g2.getRenderingHints();
  g2.setRenderingHints(Constants.DEFAULT_RENDERING_HINTS);

  Color defaultBgColor = g2.getBackground();
  Color defaultColor = g2.getColor();

  g2.setColor(previewBb.backColor);
  g2.fill(previewArea);
  g2.setBackground(previewBb.backColor);
  g2.setColor(previewBb.borderColor);
  Stroke defaultStroke = g2.getStroke();
  g2.setStroke(previewBb.getBorder());

  if (img != null)
    g2.drawImage(img, previewArea.x, previewArea.y, this);

  for (int i = 0; i < shapes.size(); i++)
    g2.draw((Shape) shapes.get(i));

  g2.setStroke(defaultStroke);
  g2.setColor(defaultColor);
  g2.setBackground(defaultBgColor);

  g2.setRenderingHints(rh);
}
 
Example 7
Source File: ByteImage.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws the image.
 * 
 * @param panel
 * @param g
 */

public void draw(DrawingPanel panel, Graphics g) {
	if (!visible) {
		return;
	}
	if(dirtyImage){
	  image = Toolkit.getDefaultToolkit().createImage(imageSource);
	}
	if (image == null) {
		panel.setMessage(DisplayRes.getString("Null Image")); //$NON-NLS-1$
		return;
	}
	Graphics2D g2 = (Graphics2D) g;
	AffineTransform gat = g2.getTransform(); // save graphics transform
	RenderingHints hints = g2.getRenderingHints();
	if (!OSPRuntime.isMac()) { // Rendering hint bug in Mac Snow Leopard
		g2.setRenderingHint(RenderingHints.KEY_DITHERING,
				RenderingHints.VALUE_DITHER_DISABLE);
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_OFF);
	}
	double sx = (xmax - xmin) * panel.xPixPerUnit / ncol;
	double sy = (ymax - ymin) * panel.yPixPerUnit / nrow;
	// translate origin to pixel location of (xmin,ymax)
	g2.transform(AffineTransform.getTranslateInstance(panel.leftGutter
			+ panel.xPixPerUnit * (xmin - panel.xmin), panel.topGutter
			+ panel.yPixPerUnit * (panel.ymax - ymax)));
	g2.transform(AffineTransform.getScaleInstance(sx, sy));  // scales image to world units
	g2.drawImage(image, 0, 0, panel);
	g2.setTransform(gat); // restore graphics conext
	g2.setRenderingHints(hints); // restore the hints
}
 
Example 8
Source File: AbstractValueModelView.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param g2d
 */
protected void paintInit ( Graphics2D g2d ) {
    RenderingHints rh = g2d.getRenderingHints();
    rh.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
    rh.put( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
    g2d.setRenderingHints( rh );

    g2d.setPaint( Color.BLACK );
    g2d.setStroke( new BasicStroke( 1.0f ) );
    g2d.setFont(ReduxConstants.sansSerif_12_Bold );

}
 
Example 9
Source File: HeatMapView.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param g2d
 */
protected void paintInit(Graphics2D g2d) {
    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    g2d.setPaint(Color.BLACK);
    g2d.setStroke(new BasicStroke(1.0f));
    g2d.setFont(ReduxConstants.sansSerif_10_Bold);
}
 
Example 10
Source File: TeXIcon.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Paint the {@link TeXFormula} that created this icon.
 */
public void paintIcon(Component c, Graphics g, int x, int y) {
    Graphics2D g2 = (Graphics2D) g;
    // copy graphics settings
    RenderingHints oldHints = g2.getRenderingHints();
    AffineTransform oldAt = g2.getTransform();
    Color oldColor = g2.getColor();

    // new settings
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_RENDERING,
                        RenderingHints.VALUE_RENDER_QUALITY);
    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    g2.scale(size, size); // the point size
    if (fg != null) {
        g2.setColor(fg);
    } else if (c != null) {
        g2.setColor(c.getForeground()); // foreground will be used as default painting color
    } else {
        g2.setColor(defaultColor);
    }

    // draw formula box
    box.draw(g2, (x + insets.left) / size, (y + insets.top) / size+ box.getHeight());

    // restore graphics settings
    g2.setRenderingHints(oldHints);
    g2.setTransform(oldAt);
    g2.setColor(oldColor);
}
 
Example 11
Source File: Graphics2DStore.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public void save(Graphics2D g2d) {
	paint = g2d.getPaint();
	font = g2d.getFont();
	stroke = g2d.getStroke();
	transform = g2d.getTransform();
	composite = g2d.getComposite();
	clip = g2d.getClip();
	renderingHints = g2d.getRenderingHints();
	color = g2d.getColor();
	background = g2d.getBackground();
}
 
Example 12
Source File: GradientEditor.java    From jclic with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
  super.paintComponent(g);
  Graphics2D g2 = (Graphics2D) g;
  RenderingHints rh = g2.getRenderingHints();
  g2.setRenderingHints(edu.xtec.jclic.Constants.DEFAULT_RENDERING_HINTS);
  gradient.paint(g2, new Rectangle(0, 0, getWidth(), getHeight()));
  g2.setRenderingHints(rh);
}
 
Example 13
Source File: GeochronAliquotManager.java    From ET_Redux with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param g2d
 */
public void paint(Graphics2D g2d) {

    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    // bottom border
    g2d.setColor(Color.black);
    // g2d.drawRect(0, getBounds().height - 1, getWidth() - 1, getBounds().height - 1);
    g2d.drawRect(1, 1, getBounds().width - 2, getBounds().height - 2);
}
 
Example 14
Source File: AbstractFitFunctionView.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @param g2d
 */
public void paint ( Graphics2D g2d ) {

    int mswdTextOffset = 120;//155
    RenderingHints rh = g2d.getRenderingHints();
    rh.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
    rh.put( RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY );
    g2d.setRenderingHints( rh );

    g2d.setPaint( Color.black );
    g2d.setFont( textFont );

    // draw border
    g2d.drawRect( 0, 0, getWidth() - 1, getHeight() - 1 );

    if (( fittedFofX != null ) && fittedFofX.verifyPositiveVariances()) {
        g2d.drawString( fittedFofX.getDescription(), leftMargin, 30 );

        g2d.setPaint( Color.red );

        // jan 2013 update to show MSWD and BIC
        g2d.setPaint( Color.red );
        g2d.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
        try {
            g2d.drawString( "MSWD"//
                    + "= " + new BigDecimal( fittedFofX.getMSWD() ).setScale( 1, RoundingMode.HALF_UP ).toPlainString()//
                    + " BIC= " + new BigDecimal( fittedFofX.getBIC() ).setScale( 1, RoundingMode.HALF_UP ).toPlainString()//
                    , getWidth() - mswdTextOffset, 14 );
        } catch (RuntimeException e) {
        }

        g2d.setFont( textFont );

        if (  ! (this instanceof SmoothingSplineFitFunctionView) ) {
            g2d.setPaint( Color.black );

            g2d.setFont( new Font( "Monospaced", Font.BOLD, 10 ) );

            g2d.drawString( "a =", leftMargin, 49 );
            g2d.drawString( "Failed fit.", leftMargin + 30, 49 );
            if ( parameterAValueSlider != null ) {
                g2d.drawString( formatValueModelSliderTwoSigmaForDisplay( parameterAValueSlider, 2 ), 118, 49 );
            }

            if ( fittedFofX.getCountOfParameters() > 1 ) {
                g2d.drawString( "b =", leftMargin, 69 );
                g2d.drawString( "Failed fit.", leftMargin + 30, 69 );
            }
            if ( parameterBValueSlider != null ) {
                g2d.drawString( formatValueModelSliderTwoSigmaForDisplay( parameterBValueSlider, 2 ), 118, 69 );
            }

            if ( fittedFofX.getCountOfParameters() > 2 ) {
                g2d.drawString( "c =", leftMargin, 89 );
                g2d.drawString( "Failed fit.", leftMargin + 30, 89 );
            }
            if ( parameterCValueSlider != null ) {
                g2d.drawString( formatValueModelSliderTwoSigmaForDisplay( parameterCValueSlider, 2 ), 118, 89 );
            }
        }
    } else if (  ! (this instanceof SmoothingSplineFitFunctionView) ) {
        g2d.setPaint( Color.red );

        // jan 2013 update to show unavailable fit
        g2d.setPaint( Color.red );
        g2d.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
        g2d.drawString( "Unable to Fit Function", getWidth() - mswdTextOffset, 14 );

        g2d.setPaint( Color.black );
    }
}
 
Example 15
Source File: Player.java    From jclic with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  if (splashImg != null) {
    int x, y, imgW, imgH;
    g2.setColor(BG_COLOR);
    g2.fill(g2.getClip());
    imgW = splashImg.getWidth(this);
    imgH = splashImg.getHeight(this);
    x = (getBounds().width - imgW) / 2;
    y = (getBounds().height - imgH) / 2;
    g2.drawImage(splashImg, x, y, this);
    return;
  }

  Rectangle rBounds = new Rectangle(0, 0, getWidth(), getHeight());

  if (actPanel == null || actPanel.getActivity().bgGradient == null
      || actPanel.getActivity().bgGradient.hasTransparency())
    super.paintComponent(g);

  if (actPanel != null && (actPanel.getActivity().bgGradient != null || actPanel.bgImage != null)) {
    RenderingHints rh = g2.getRenderingHints();
    g2.setRenderingHints(DEFAULT_RENDERING_HINTS);

    if (actPanel.getActivity().bgGradient != null)
      actPanel.getActivity().bgGradient.paint(g2, rBounds);

    if (actPanel.bgImage != null) {
      Rectangle r = new Rectangle(0, 0, actPanel.bgImage.getWidth(this), actPanel.bgImage.getHeight(this));
      Rectangle gBounds = g2.getClipBounds();

      if (!actPanel.getActivity().tiledBgImg) {
        r.setLocation(bgImageOrigin);
        if (r.intersects(gBounds)) {
          g2.drawImage(actPanel.bgImage, bgImageOrigin.x, bgImageOrigin.y, this);
        }
      } else {
        Utils.tileImage(g2, actPanel.bgImage, rBounds, r, this);
      }
    }
    g2.setRenderingHints(rh);
  }
}
 
Example 16
Source File: ValueModelSliderLabel.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param g2d
 */
public void paint(Graphics2D g2d) {

    RenderingHints rh = g2d.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHints(rh);

    g2d.setColor(Color.BLACK);

    g2d.setFont(textFont);

    g2d.drawString(text, 1, 11);//12);

    g2d.setColor(Color.gray);
  //  g2d.drawLine(0, 0, getWidth(), 0);

}
 
Example 17
Source File: OSPLog.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates the GUI.
 */
protected void createGUI() {
  // create the panel, text pane and scroller
  logPanel = new JPanel(new BorderLayout());
  logPanel.setPreferredSize(new Dimension(480, 240));
  setContentPane(logPanel);
  textPane = new JTextPane() {
    public void paintComponent(Graphics g) {
      if(OSPRuntime.antiAliasText) {
        Graphics2D g2 = (Graphics2D) g;
        RenderingHints rh = g2.getRenderingHints();
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      }
      super.paintComponent(g);
    }

  };
  textPane.setEditable(false);
  textPane.setAutoscrolls(true);
  JScrollPane textScroller = new JScrollPane(textPane);
  textScroller.setWheelScrollingEnabled(true);
  logPanel.add(textScroller, BorderLayout.CENTER);
  // create the colored styles
  black = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
  red = textPane.addStyle("red", black); //$NON-NLS-1$
  StyleConstants.setForeground(red, DARK_RED);
  blue = textPane.addStyle("blue", black); //$NON-NLS-1$
  StyleConstants.setForeground(blue, DARK_BLUE);
  green = textPane.addStyle("green", black); //$NON-NLS-1$
  StyleConstants.setForeground(green, DARK_GREEN);
  magenta = textPane.addStyle("magenta", black); //$NON-NLS-1$
  StyleConstants.setForeground(magenta, Color.MAGENTA);
  gray = textPane.addStyle("gray", black); //$NON-NLS-1$
  StyleConstants.setForeground(gray, Color.GRAY);
  // create the logger
  createLogger();
  // create the menus
  createMenus();
  pack();
  textPane.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
      try {
        if(OSPRuntime.isPopupTrigger(e)) {
          // show popup menu
          if(popup!=null) {
          	FontSizer.setFonts(popup, FontSizer.getLevel());
            popup.show(textPane, e.getX(), e.getY()+8);
          }
        }
      } catch(Exception ex) {
        System.err.println("Error in mouse action."); //$NON-NLS-1$
        System.err.println(ex.toString());
        ex.printStackTrace();
      }
    }

  });
}
 
Example 18
Source File: ActivityEditorFramePanel.java    From jclic with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void paintComponent(Graphics g) {
  Graphics2D g2 = (Graphics2D) g;

  Rectangle rBounds = new Rectangle(0, 0, getWidth(), getHeight());

  if (bgGradient == null || bgGradient.hasTransparency())
    super.paintComponent(g);

  if (bgGradient != null || bgImage != null) {
    RenderingHints rh = g2.getRenderingHints();
    g2.setRenderingHints(edu.xtec.jclic.Constants.DEFAULT_RENDERING_HINTS);

    if (bgGradient != null)
      bgGradient.paint(g2, rBounds);

    if (bgImage != null) {
      Rectangle r = new Rectangle(0, 0, bgImage.getWidth(this), bgImage.getHeight(this));
      Rectangle gBounds = g2.getClipBounds();

      if (!tiledBgImg) {
        r.setLocation(bgImageOrigin);
        if (r.intersects(gBounds)) {
          if (scale == 1.0)
            g2.drawImage(bgImage, bgImageOrigin.x, bgImageOrigin.y, this);
          else {
            int w0 = bgImage.getWidth(this);
            int h0 = bgImage.getHeight(this);
            int w = (int) (scale * w0);
            int h = (int) (scale * h0);
            g2.drawImage(bgImage, bgImageOrigin.x, bgImageOrigin.y, bgImageOrigin.x + w, bgImageOrigin.y + h, 0, 0,
                w0, h0, this);
          }
        }
      } else {
        Utils.tileImage(g2, bgImage, rBounds, r, this);
      }
    }
    g2.setRenderingHints(rh);
  }
}
 
Example 19
Source File: OSPControl.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 *  Constructs an OSPControl.
 *
 * @param  _model
 */
public OSPControl(Object _model) {
  super(ControlsRes.getString("OSPControl.Default_Title")); //$NON-NLS-1$
  model = _model;
  if(model!=null) {
    // added by D Brown 2006-09-10
    // modified by D Brown 2007-10-17
    if(OSPRuntime.getTranslator()!=null) {
      OSPRuntime.getTranslator().associate(this, model.getClass());
    }
    String name = model.getClass().getName();
    setTitle(name.substring(1+name.lastIndexOf("."))+ControlsRes.getString("OSPControl.Controller")); //$NON-NLS-1$ //$NON-NLS-2$
  }
  Font labelFont = new Font("Dialog", Font.BOLD, 12); //$NON-NLS-1$
  inputLabel = new JLabel(ControlsRes.getString("OSPControl.Input_Parameters"), SwingConstants.CENTER); //$NON-NLS-1$
  inputLabel.setFont(labelFont);
  messageTextArea = new JTextArea(5, 5) {
    public void paintComponent(Graphics g) {
      if(OSPRuntime.antiAliasText) {
        Graphics2D g2 = (Graphics2D) g;
        RenderingHints rh = g2.getRenderingHints();
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      }
      super.paintComponent(g);
    }

  };
  JScrollPane messageScrollPane = new JScrollPane(messageTextArea);
  // contains a view of the control
  JPanel topPanel = new JPanel(new BorderLayout());
  topPanel.add(inputLabel, BorderLayout.NORTH);
  topPanel.add(controlScrollPane, BorderLayout.CENTER);
  buttonPanel.setVisible(true);
  topPanel.add(buttonPanel, BorderLayout.SOUTH); // buttons are added using addButton method.
  // clear panel acts like a button to clear the message area
  JPanel clearPanel = new JPanel(new BorderLayout());
  clearPanel.addMouseListener(new ClearMouseAdapter());
  clearLabel = new JLabel(ControlsRes.getString("OSPControl.Clear")); //$NON-NLS-1$
  clearLabel.setFont(new Font(clearLabel.getFont().getFamily(), Font.PLAIN, 9));
  clearLabel.setForeground(Color.black);
  clearPanel.add(clearLabel, BorderLayout.WEST);
  // contains the messages
  JPanel bottomPanel = new JPanel(new BorderLayout());
  messageLabel = new JLabel(ControlsRes.getString("OSPControl.Messages"), SwingConstants.CENTER); //$NON-NLS-1$
  messageLabel.setFont(labelFont);
  bottomPanel.add(messageLabel, BorderLayout.NORTH);
  bottomPanel.add(messageScrollPane, BorderLayout.CENTER);
  bottomPanel.add(clearPanel, BorderLayout.SOUTH);
  Container cp = getContentPane();
  splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, bottomPanel);
  splitPane.setOneTouchExpandable(true);
  cp.add(splitPane, BorderLayout.CENTER);
  messageTextArea.setEditable(false);
  controlScrollPane.setPreferredSize(new Dimension(350, 200));
  controlScrollPane.setMinimumSize(new Dimension(0, 50));
  messageScrollPane.setPreferredSize(new Dimension(350, 75));
  if((OSPRuntime.getTranslator()!=null)&&(model!=null)) {
    OSPRuntime.getTranslator().associate(table, model.getClass());
  }
  Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
  setLocation((d.width-getSize().width)/2, (d.height-getSize().height)/2); // center the frame
  init();
  ToolsRes.addPropertyChangeListener("locale", this);                      //$NON-NLS-1$
}
 
Example 20
Source File: CurvesPanel.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License votes vote down vote up
@Override
    protected void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;

        RenderingHints oldHints = g2.getRenderingHints();
        g2.setRenderingHints(hints);
        
        float width = getWidth();
        float height = getHeight();
        
        g2.translate(0, -30);

        drawCurve(g2,
                20.0f, -10.0f, 20.0f, -10.0f,
                width / 2.0f - 40.0f, 10.0f,
                0.0f, -5.0f,
                width / 2.0f + 40, 1.0f,
                0.0f, 5.0f,
                50.0f, 5.0f, false);

        g2.translate(0, 30);
        g2.translate(0, height - 60);

        drawCurve(g2,
                30.0f, -15.0f, 50.0f, 15.0f,
                width / 2.0f - 40.0f, 1.0f,
                15.0f, -25.0f,
                width / 2.0f, 1.0f / 2.0f,
                0.0f, 25.0f,
                15.0f, 9.0f, false);

        g2.translate(0, -height + 60);
        
        drawCurve(g2,
                height - 35.0f, -5.0f, height - 50.0f, 10.0f,
                width / 2.0f - 40.0f, 1.0f,
                height - 35.0f, -25.0f,
                width / 2.0f, 1.0f / 2.0f,
                height - 20.0f, 25.0f,
                25.0f, 7.0f, true);
        
        g2.setRenderingHints(oldHints);
    }