Canvas « JPanel « Java Swing Q&A





1. How to draw a JPanel on a canvas?    stackoverflow.com

is there a possibility to draw a JPanel on a specific location op a Graphics (or Graphics2D) object? I override the paint method of my canvas, and call panel.paint(g) in there, but ...

2. Problems with setting JPanel's colour    stackoverflow.com

Here's my canvas class extending JPanel:

package start;

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

public class Board extends JPanel
{
    private static final long serialVersionUID = 1L;

    public Board() {}

  ...

3. Transparent JPanel over Canvas (VLCJ)    stackoverflow.com

I know that a similar question was posted before, but there was no answer or example code. I need a transparent JPanel on top of a canvas. The code posted below ...

4. Java Canvas or JPanel    stackoverflow.com

When making a graphics canvas in Java, which would be better to extend? Should you extend JPanel or Canvas? Are there any performance considerations?

5. Drawing canvas in Apache Pivot    stackoverflow.com

I am currently building a drawing application (like Paint) in Apache Pivot, but I can't figure out how to make the actual canvas. E.g. org.apache.pivot.wtk.Component has the getGraphics() method, known from ...

6. [Java]: JPanel + Canvas (sunAwtCanvas), doubts    stackoverflow.com

I would like to understand the logic of a certain application: I don't have the code, only same (few) data about it. Firs: This is build in Java and run like a ...

8. add a Canvas to a JPanel within a JFrame    coderanch.com

hi there! i extends Canvas and i draw image in it like this : public class testImage extends JFrame{ public testImage(){ imageViewer m = new imageViewer("http://127.0.0.1/image/samifox.gif"); getContentPane().add(m); } public static void main(String[] args) { JFrame frame = new testImage(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); //frame.pack(); frame.setSize(300,300); frame.setVisible(true); } } class imageViewer extends Canvas{ Image image; ...

9. inserting canvas in a panel    coderanch.com

Hi, i have tried this in numerous ways but couldnt succed,still trying, here is the problem. I have a JFrame which i have divided into so many cells using gridbaglayout, in one big cell, i placed a jpanel, it has hscroll and vscroll bars, i have to insert canvas into this panel. here is where im failing. i have used a ...





10. Extending Canvas vs JPanel for gfx    coderanch.com

11. Canvas and JPanel    coderanch.com

12. Panel vs Canvas    coderanch.com

13. Difference between Panel and Canvas    coderanch.com

14. add a Canvas to a JPanel within a JFrame    coderanch.com

hi there! i extends Canvas and i draw image in it like this : public class testImage extends JFrame{ public testImage(){ imageViewer m = new imageViewer("http://127.0.0.1/image/samifox.gif"); getContentPane().add(m); } public static void main(String[] args) { JFrame frame = new testImage(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); //frame.pack(); frame.setSize(300,300); frame.setVisible(true); } } class imageViewer extends Canvas{ Image image; ...

15. use a Canvas or JPanel?    forums.oracle.com