javax.swing.JFrame.getGraphics()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中javax.swing.JFrame.getGraphics()方法的一些代码示例,展示了JFrame.getGraphics()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getGraphics()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getGraphics

JFrame.getGraphics介绍

暂无

代码示例

代码示例来源:origin: fossasia/neurolab-desktop

frameGraphics = frame.getGraphics();

代码示例来源:origin: stackoverflow.com

public static void main (String[]args) {
  JFrame frame= new JFrame ();
  frame.setSize(400, 400);
  Graphics g = frame.getGraphics();
  drawShape(g);
  frame.setVisible(true);
}

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
 JPanel panel = new JPanel();
 frame.add(panel);
 frame.setVisible(true);
 Graphics frameContext = frame.getGraphics();
 Graphics panelContext = panel.getGraphics();        
 if (frameContext.equals(panelContext)){
   System.out.println("The contexts are the same.");
 } else {
   System.out.println("The contexts are different.");
 }

代码示例来源:origin: com.jtattoo/JTattoo

public void run() {
    if (window != null) {
      if (window instanceof JFrame) {
        JFrame frame = (JFrame) window;
        frame.update(frame.getGraphics());
      }
    }
  }
});

代码示例来源:origin: floetteroed.utilities/floetteroed-utilities

public void run() {
    vizFrame.paint(vizFrame.getGraphics());
  }
});

代码示例来源:origin: klamonte/jexer

/**
 * Creates a graphics context for this component. This method will return
 * null if this component is currently not displayable.
 *
 * @return a graphics context for this component, or null if it has none
 */
public Graphics getGraphics() {
  if (frame != null) {
    return frame.getGraphics();
  } else {
    return component.getGraphics();
  }
}

代码示例来源:origin: uk.ac.ebi.intact.app/data-conversion

public void updateProteinProcessedCound( final int newCount ) {
  if ( progressBar == null ) {
    throw new NullPointerException( "The progress bar hasn't been created." );
  }
  // update current element
  current = newCount;
  currentLabel.setText( "Current: " + current );
  currentLabel.update( frame.getGraphics() );
  // update the progress bar
  progressBar.setValue( current );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: uk.ac.ebi.intact.util/data-conversion

public void updateProteinProcessedCound( final int newCount ) {
  if ( progressBar == null ) {
    throw new NullPointerException( "The progress bar hasn't been created." );
  }
  // update current element
  current = newCount;
  currentLabel.setText( "Current: " + current );
  currentLabel.update( frame.getGraphics() );
  // update the progress bar
  progressBar.setValue( current );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi.legacy/data-conversion

public void updateProteinProcessedCound( final int newCount ) {
  if ( progressBar == null ) {
    throw new NullPointerException( "The progress bar hasn't been created." );
  }
  // update current element
  current = newCount;
  currentLabel.setText( "Current: " + current );
  currentLabel.update( frame.getGraphics() );
  // update the progress bar
  progressBar.setValue( current );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: uk.ac.ebi.intact.app/data-conversion

public void setStatus( final String status ) {
  // update status
  statusLabel.setText( status );
  statusLabel.update( frame.getGraphics() );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: uk.ac.ebi.intact.dataexchange.psimi.legacy/data-conversion

public void setStatus( final String status ) {
  // update status
  statusLabel.setText( status );
  statusLabel.update( frame.getGraphics() );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: uk.ac.ebi.intact.util/data-conversion

public void setStatus( final String status ) {
  // update status
  statusLabel.setText( status );
  statusLabel.update( frame.getGraphics() );
  frame.setTitle( getWindowsTitle() );
}

代码示例来源:origin: stackoverflow.com

JFrame workingManager = new JFrame("Hello");
 Graphics g = workingManager.getGraphics();
 JPanel jp = (JPanel) workingManager.getContentPane();
 workingManager.paintComponents(g);
 g.fillOval(0, 0, 30, 30);
 g.drawOval(0, 50, 30, 30);
 g.setColor(Color.CYAN);
 workingManager.setSize(500, 500);
 workingManager.setVisible(true);

代码示例来源:origin: stackoverflow.com

setDefaultCloseOperation(3);
setVisible(true);
timer(getGraphics()); //call the timer from here, so there's only one running

代码示例来源:origin: stackoverflow.com

@Override
public void actionPerformed(ActionEvent e) {
  drawARectangle(frame.getGraphics());

代码示例来源:origin: stackoverflow.com

printAll(getGraphics());//Extort print all content

代码示例来源:origin: stackoverflow.com

public void mouseClicked(MouseEvent e) {
paintStuff(frame.getGraphics(),e.getX(), e.getY());
public void mouseEntered(MouseEvent e) {
PaintRectangleAtPoint(frame.getGraphics(),100, e.getY(), "entered");

代码示例来源:origin: stackoverflow.com

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;

  public class Polygon extends JFrame {
    public static void main(String args[]){
      Test a = new Test();
      a.drawAPolygon();
    }

    public Polygon(){
      setSize(300,300);
      setVisible(true);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    void drawAPolygon(int[] xPoints, int[] yPoints, int numPoints){
      Graphics g = getGraphics();
      g.drawPolygon(xPoints, yPoints, numPoints);
    }
    //@override
      public void paint(Graphics g){
      super.paint(g);
      //could also do painting in here.
    }
  }

代码示例来源:origin: geogebra/geogebra

public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.setVisible(true);
    Graphics2D g = (Graphics2D) frame.getGraphics();
    for (int i = 0; i < 3000; i++) {
      char c = (char) i;
      TextLayoutD ld = new TextLayoutD(c + "", frame.getFont(),
          g.getFontRenderContext());
      System.out.println(i + " (" + c + ") : "
          + ld.getBounds().getY() / ld.getBounds().getHeight());
    }
  }
}

代码示例来源:origin: net.sf.sf3jswing/kernel-core

splashFrame.setVisible(true);
splashFrame.setAlwaysOnTop(false);
splashFrame.update(splashFrame.getGraphics());

相关文章

JFrame类方法