¡@

Home 

java Programming Glossary: g2

paintComponent does not work if its called by the recursive function?

http://stackoverflow.com/questions/10338163/paintcomponent-does-not-work-if-its-called-by-the-recursive-function

Graphics g super.paintComponent g Graphics2D g2 Graphics2D g g2.fillOval x 2 y 2 4 4 System.out.println paintComponent.. g super.paintComponent g Graphics2D g2 Graphics2D g g2.fillOval x 2 y 2 4 4 System.out.println paintComponent public.. Graphics g g.clearRect 0 0 getWidth getHeight Graphics2D g2 Graphics2D g g2.fillOval x y 4 4 Here is the code that will..

Java Bouncing Ball

http://stackoverflow.com/questions/13022754/java-bouncing-ball

Graphics g super.paintComponent g Graphics2D g2 Graphics2D g g2.setRenderingHint RenderingHints.KEY_ANTIALIASING.. g super.paintComponent g Graphics2D g2 Graphics2D g g2.setRenderingHint RenderingHints.KEY_ANTIALIASING RenderingHints.VALUE_ANTIALIAS_ON.. x y 30 30 adds color to circle g.setColor Color.black g2.drawOval x y 30 30 draws circle public void run while isVisible..

Java rectangle collision detection confusion

http://stackoverflow.com/questions/13825515/java-rectangle-collision-detection-confusion

100 100 BufferedImage.TYPE_INT_ARGB Graphics2D g2 img.createGraphics g2.setColor Color.WHITE g2.fillRect 0 0 img.getWidth.. Graphics2D g2 img.createGraphics g2.setColor Color.WHITE g2.fillRect 0 0 img.getWidth img.getHeight.. Graphics2D g2 img.createGraphics g2.setColor Color.WHITE g2.fillRect 0 0 img.getWidth img.getHeight return img private BufferedImage..

Threads with Key Bindings

http://stackoverflow.com/questions/13999506/threads-with-key-bindings

BufferedImage w h BufferedImage.TYPE_INT_ARGB Graphics2D g2 img.createGraphics switch color.toLowerCase case green g2.setColor.. img.createGraphics switch color.toLowerCase case green g2.setColor Color.GREEN break case magenta g2.setColor Color.MAGENTA.. case green g2.setColor Color.GREEN break case magenta g2.setColor Color.MAGENTA break case red g2.setColor Color.RED..

Java, how to draw constantly changing graphics

http://stackoverflow.com/questions/3742731/java-how-to-draw-constantly-changing-graphics

attempt is not on event dispatch thread final Graphics2D g2 Graphics2D g g2.setColor getBackground try for int x 0 x 8 x.. on event dispatch thread final Graphics2D g2 Graphics2D g g2.setColor getBackground try for int x 0 x 8 x for int y 0 y.. getBackground try for int x 0 x 8 x for int y 0 y 8 y g2.setColor model x y Ellipse2D e new Ellipse2D.Double 40 x STEP..

Swing: Obtain Image of JFrame

http://stackoverflow.com/questions/5853879/swing-obtain-image-of-jframe

10 g.setColor Color.black textLabel.paint g Graphics g2 image.getGraphics g2.drawImage bi 20 20 f ImageIcon ii new.. textLabel.paint g Graphics g2 image.getGraphics g2.drawImage bi 20 20 f ImageIcon ii new ImageIcon image JLabel..

How to make a color transparent in a BufferedImage and save as PNG

http://stackoverflow.com/questions/665406/how-to-make-a-color-transparent-in-a-bufferedimage-and-save-as-png

imageHeight BufferedImage.TYPE_INT_ARGB Graphics2D g2 dest.createGraphics g2.drawImage image 0 0 null g2.dispose EDIT.. Graphics2D g2 dest.createGraphics g2.drawImage image 0 0 null g2.dispose EDIT 2 I come after Christoffer.. g2 dest.createGraphics g2.drawImage image 0 0 null g2.dispose EDIT 2 I come after Christoffer posted his complete..

JTable how to change BackGround Color

http://stackoverflow.com/questions/8197261/jtable-how-to-change-background-color

JViewport.SIMPLE_SCROLL_MODE Graphics2D g2 shadow.createGraphics g2.setPaint new Color 250 150 150 g2.fillRect.. Graphics2D g2 shadow.createGraphics g2.setPaint new Color 250 150 150 g2.fillRect 0 0 1 h g2.setComposite.. g2 shadow.createGraphics g2.setPaint new Color 250 150 150 g2.fillRect 0 0 1 h g2.setComposite AlphaComposite.DstIn g2.setPaint..

Internal padding for JTextArea with background Image

http://stackoverflow.com/questions/8462414/internal-padding-for-jtextarea-with-background-image

c Graphics g int x int y int width int height Graphics2D g2 Graphics2D g int bottomLineY height thickness pointerSize RoundRectangle2D.Double.. Area area new Area bubble area.add new Area pointer g2.setRenderingHints hints Area spareSpace new Area new Rectangle.. new Rectangle 0 0 width height spareSpace.subtract area g2.setClip spareSpace g2.clearRect 0 0 width height g2.setClip..

Passing current Date

http://stackoverflow.com/questions/8614972/passing-current-date

private void paintBackGround Color g Graphics2D g2 shadow.createGraphics g2.setPaint g g2.fillRect 0 0 1 h g2.setComposite.. Color g Graphics2D g2 shadow.createGraphics g2.setPaint g g2.fillRect 0 0 1 h g2.setComposite AlphaComposite.DstIn.. g Graphics2D g2 shadow.createGraphics g2.setPaint g g2.fillRect 0 0 1 h g2.setComposite AlphaComposite.DstIn g2.setPaint..

Drawing rectangle on a JPanel

http://stackoverflow.com/questions/9258890/drawing-rectangle-on-a-jpanel

Color.white public void paint Graphics g Graphics2D g2 Graphics2D g w getSize .width h getSize .height if clip Ellipse2D.. r new Rectangle2D.Float w 4.0f h 4.0f wi 2.0f hi 2.0f g2.setClip e System.out.println Width wi Height hi g2.setClip r.. 2.0f g2.setClip e System.out.println Width wi Height hi g2.setClip r System.out.println g2.getClipBounds if shape.selectedcolor..