1. jpeg in a Jpanel coderanch.comI think this should work for you: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test { public static void main(String[] args) { JFrame frame = new JFrame(); JPanel panel = new JPanel(); JLabel label = new JLabel(); label.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().getImage("C:\\sample.jpg"))); label.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { JLabel source = (JLabel) e.getSource(); ImageIcon icon = (ImageIcon) source.getIcon(); Image image = ... |
2. Saving Canvas/Panel as a JPEG image coderanch.comimport java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.*; import java.net.*; import javax.imageio.ImageIO; import javax.swing.*; import javax.swing.event.*; public class SavingAPanel { public static void main(String[] args) { ImagePanel panel = new ImagePanel(); Save save = new Save(panel); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(save.getUIPanel(), "North"); f.getContentPane().add(new JScrollPane(panel)); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } } class ImagePanel extends JPanel { Rectangle r; boolean marking; Point ... |
3. set the background panel to an jpeg and display text in front of it coderanch.comI'm trying to set the background to a jpeg but i want to have a little text panel on top of it at the bottom that describes the image. Can some explain to me what i am missing? I am just not understanding. A point to a direction would be appreciated. I get the following error messages when i compile: cannot ... |
4. Saving a Jpanel as a JPEG coderanch.comIve tried everything, but all i can save is the background, WHY WHY WHY ??? is the forground (ie, anything i draw on my panel) not saved when i atempt to save the image. It makes no sense what so ever, if its drawing it to screen, why is it not saving the image as a whole ??? Please any help ... |
5. Save JPanel with multiple charts as jpeg jfree.org |