Java 6u10 graphic bug

I've noticed that with Java6u10 my graphics (Java2D) is rendered differently. Why is this?
Here is a screen of Java6(update1)
http://img356.imageshack.us/my.php?image=java61xi9.jpg
And here is a screen of the same program with Java6u10
http://img186.imageshack.us/my.php?image=java610ze0.jpg
<img src="file:///C:/DOCUME%7E1/mmarcon/IMPOST%7E1/Temp/moz-screenshot.jpg" alt="" />

might be driver issues; update 10 uses Direct3D9 by default. Do you have the latest drivers for your videocard? If so, try to run the app on another computer to see if the issues remain. You can also try disabling the Direct3D pipeline using the command line parameter:
-Dsun.java2d.d3d=false

Similar Messages

  • JAVA Drawing Graphics Save as JPEG?

    My problem is this, I am trying to save my g2 graphic image to a jpg. This is how I have things setup, I will show code and my thoughts. What I need is help to figure out how I could save seperate .java files graphics g to the jpg format from a JFileChooser in a different .java file.
    HERE IS THE CODE FOR HOW GRAPH IS CREATED. graph.java
    I have a graph I am drawing in a seperate .java file and it is created like this:
    public class graph extends JPanel {
        public static Graphics2D g2;
        final int HPAD = 60, VPAD = 40;
        int[] data;
        Font font;
        public test() {
            data = new int[] {120, 190, 211, 75, 30, 290, 182, 65, 85, 120, 100, 101};
            font = new Font("lucida sans regular", Font.PLAIN, 8);       
            setBackground(Color.white);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            int w = getWidth();
            int h = getHeight();
            // scales
            float xInc = (w - HPAD - HPAD) / 10f;
            float yInc = (h - 2*VPAD) / 10f;
            int[] dataVals = getDataVals();
            float yScale = dataVals[2] / 10f;
    //        etc... (the rest is just drawing...blah...blah)
    }HERE IS THE CODE FOR HOW MY GRAPH IS DISPLAYED AND TRYING TO BE SAVED. results.java
    The graph I created is then displayed in a JPanel and there is a button in the results window to save the graph results. This is where I am having difficulty as I am trying to save the g2 from graph.java (declared public static...not sure if this a good idea) but anyway I want to save this as a jpg heres the code:
            resultPanel = new JPanel(new PercentLayout());
            graph drawing = new graph();
            resultPanel.add (
                drawing,
                new PercentLayout.Constraint(1,41,49,50));
            resultPanel.add (
                saveButton1,
                new PercentLayout.Constraint(1,94,25,5));
        public void actionPerformed(ActionEvent e) {
            if(e.getSource() == saveButton1) {
                doSaveGraph();
        public void doSaveGraph() {
            JFileChooser fileSaver;
            fileSaver = new JFileChooser(); // The file-opening dialog
            ExampleFileFilter filter = new ExampleFileFilter("jpg");
            filter.setDescription("JPEG Picture File");
            fileSaver.addChoosableFileFilter(filter);
            try {
                if(fileSaver.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
                    File f = fileSaver.getSelectedFile();
                    BufferedImage img = new BufferedImage(672,600, BufferedImage.TYPE_INT_RGB);
          // SOMEWHERE IN HERE IS WHERE I NEED TO GRAB G2?  I AM NOT SURE WHAT TO DO HERE
                    //Graphics g = img.getGraphics();
                    //panel.paint(g);
                    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(f));
                    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img);
                    param.setQuality(1f, true);
                    encoder.setJPEGEncodeParam(param);
                    encoder.encode(img);
                    System.out.println("It worked");
                else{}
            catch (Exception e) {
                e.printStackTrace();
    ...If you can help me I will be very happy, and give you 10 dukes! LOL and I appreciate the help!

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class SavingGraphics
        public static void main(String[] args)
            GraphicsCreationPanel graphicsPanel = new GraphicsCreationPanel();
            GraphicsSaver saver = new GraphicsSaver(graphicsPanel);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(saver.getUIPanel(), "North");
            f.getContentPane().add(graphicsPanel);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class GraphicsCreationPanel extends JPanel
        String text;
        Font font;
        public GraphicsCreationPanel()
            text = "hello world";
            font = new Font("lucida bright regular", Font.PLAIN, 36);
            setBackground(Color.white);
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            g2.setPaint(Color.blue);
            g2.draw(new Rectangle2D.Double(w/16, h/16, w*7/8, h*7/8));
            g2.setPaint(Color.orange);
            g2.fill(new Ellipse2D.Double(w/12, h/12, w*5/6, h*5/6));
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(w/6, h/6, w*2/3, h*2/3));
            g2.setPaint(Color.black);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics(text, frc);
            float textWidth = (float)font.getStringBounds(text, frc).getWidth();
            float x = (w - textWidth)/2;
            float y = (h + lm.getHeight())/2 - lm.getDescent();
            g2.drawString(text, x, y);
    class GraphicsSaver
        GraphicsCreationPanel graphicsPanel;
        JFileChooser fileChooser;
        public GraphicsSaver(GraphicsCreationPanel gcp)
            graphicsPanel = gcp;
            fileChooser = new JFileChooser(".");
        private void save()
            if(fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION)
                File file = fileChooser.getSelectedFile();
                String ext = file.getPath().substring(file.getPath().indexOf(".") + 1);
                BufferedImage image = getImage();
                try
                    ImageIO.write(image, ext, file);
                catch(IOException ioe)
                    System.out.println("write: " + ioe.getMessage());
        private BufferedImage getImage()
            int w = graphicsPanel.getWidth();
            int h = graphicsPanel.getHeight();
            BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = bi.createGraphics();
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            graphicsPanel.paint(g2);
            g2.dispose();
            return bi;
        public JPanel getUIPanel()
            JButton save = new JButton("save");
            save.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    save();
            JPanel panel = new JPanel();
            panel.add(save);
            return panel;
    }

  • When to Use XSLT,Java or Graphical Mapping

    Hi Friends,
       Could any one please give me a clear picture on when to use Java/XSLT/Graphical Mappings. Which mapping should be used in which case.
    Regards,
    Shyam

    Hi
       Plz check the below links for your answer..
    Java Mapping : http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    XSLT mapping : http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    Message mapping:
    http://help.sap.com/saphelp_nw04/helpdata/en/ee/bf9640dc522f28e10000000a1550b0/content.htm
    Regards
    Su

  • Applet launching browser window in Java 6u10+

    Finding a problem that appears to be limited to Java 6u10+. We have an applet which opens multiple JFrame windows, and in some cases, the user might click something in the applet that should trigger the browser to show a popup browser window with some web page. That part all works fine, and the browser popup shows in the front as it should in older java versions.
    However, it appears that since 6u10, now that the applet process is separate from the browser, the popup window no longer can be brought to the front of the applets. It is being launched and brought to front with Javascript, but that only brings it in front of other browser windows, no longer in front of the applet. And the only thing I can find to resolve this is to minimize/iconify the applet windows, and that's not ideal to hide all windows.
    Is there anyone else seeing this? Has anyone found any fix or work around for this (without minimizing all the applet windows)?
    thanks

    in Java 6u10 it works?
    I guess it's similar. My applet calls showDocument(), but it is only passing a URL with query string parameters which the page called reads (via Javascript) and uses JS to call window.open() with the contents based on those parameters. I don't have access to the system to change the way the web works. The team that does has looked into it, and said they do make the tofront call in JS to push the browser window up. But it won't go up all the way, only above other browser windows, and not the applet window (which is a JFrame). Then the OS (windows in this case) starts blinking the taskbar button for the popup window for attention, but that's not helpful.
    The only common factor in the reports were that it's Java 6u10 or higher. XP, Vista, FF, IE, all had the problem with 6u10+. And knowing how Sun changed the plug-in architecture, it actually makes some sense as to why this happens. However, this seems to be something that there is no way to fix short of Sun doing something. Or as mentioned, minimize my window just to let others show up, which is going to be annoying as a user to have to restore the window to go back.

  • [Win8.1] Video fullscreen graphic bug

    Hello,
    i've a big Problem.
    I've found a new Sony Vaio multi-flip 15 under the christmas tree ;-).
    Now i've installed all Updates incl. Windows 8.1.
    All is wonderful, but when i watch some Youtube-Videos in fullscreen mode i got this graphic-bug (see below).
    With Firefox i've just this bug in fullscreen mode. With IE also in small mode.
    Windows 8.1
    Firefox 26.0
    Adobe Flash Player 11
    The Problem is solved if i disable the hardware acceleration, but then i get a big version of the player-UI and bad graphic.
    With the Windows 8-App "Hyper for Youtube" i got the same problem without any Browser.
    Thanks in advance

    You've already found one fo the two possible solutions... disabling HW accelleration.
    The other is to update your video drivers. http://forums.adobe.com/thread/945765  (Update through the adapter manufacturer - NOT Windows)

  • Cannot resolve symbol java.awt.graphics

    // DrawRectangleDemo.java
    import java.awt.*;
    import java.lang.Object;
    import java.applet.Applet;
    public class DrawRectangleDemo extends Applet
         public void paint (Graphics g)
              // Get the height and width of the applet's drawing surface.
              int width = getSize ().width;
              int height = getSize ().height;
              int rectWidth = (width-50)/3;
              int rectHeight = (height-70)/2;
              int x = 5;
              int y = 5;
              g.drawRect (x, y, rectWidth, rectHeight);
              g.drawString ("drawRect", x, rectHeight + 30);
              x += rectWidth + 20;
              g.fillRect (x, y, rectWidth, rectHeight);
              // Calculate a border area with each side equal tp 25% of
              // the rectangle's width.
              int border = (int) (rectWidth * 0.25);
              // Clear 50% of the filled rectangle.
              g.clearRect (x + border, y + border,
                             rectWidth - 2 * border, rectHeight - 2 * border);
              g.drawString ("fillRect/clearRect", x, rectHeight + 30);
              x += rectWidth + 20;
              g.drawRoundRect (x, y, rectWidth, rectHeight, 15, 15);
              g.drawString ("drawRoundRect", x, rectHeight + 30);
              x=5;
              y += rectHeight + 40;
              g.setColor (Color.yellow);
              for (int i = 0; i < 4; i++)
                   g.draw3DRect (x + i * 2, y + i * 2,
                                       rectWidth - i * 4, rectHeight - i * 4, false);
              g.setColor (Color.black);
              g.drawString ("draw3DRect", x, y, + rectHeight + 25);
              x += rectWidth + 20;
              g.setColor (Color.yellow);
              g.fill3DRect (x, y, rectWidth, rectHeight, true);
              g.setColor (Color.black);
              g.drawString ("fill3DRect", x, y, + rectHeight + 25);
    Help me with this codes. I typed correctly but there still errors.
    --------------------Configuration: JDK version 1.3.1 <Default>--------------------
    D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:56: cannot resolve symbol
    symbol : method drawString (java.lang.String,int,int,int)
    location: class java.awt.Graphics
              g.drawString ("draw3DRect", x, y, + rectHeight + 25);
    ^
    D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:64: cannot resolve symbol
    symbol : method drawString (java.lang.String,int,int,int)
    location: class java.awt.Graphics
              g.drawString ("fill3DRect", x, y, + rectHeight + 25);
    ^
    2 errors
    Process completed.
    -------------------------------------------------------------------------------------------------------------------------------

    cannot resolve symbol
    symbol : method drawString (java.lang.String,int,int,int)
    This is telling you that you are trying to invoke the drawString() method with 4 parameters: String, int, int, int
    If you look at the API the drawString() method need 3 parameters: String, int, int - so you have an extra int
    location: class java.awt.Graphics
    g.drawString ("draw3DRect", x, y, + rectHeight + 25);
    Now is you look at your code you will find that you have 3 ',' in you method call. (I don't think you want the ',' after the y.

  • Installing Java 6u10 beta on an openSUSE linux computer

    Alright, I hope I posted this in the right spot.
    I recently started running openSUSE and am clueless as to how to run the package manager for it. So I decided to download the Java 6u10 JDK and install it manually. However, I'm not quite sure how to do that, either. The only command I know as far as installing packages is
    "sh packagename" or "sudo sh packagename"
    It appears to work at first, but after I agree to the license stuff, it throws a bunch of errors and fails.
    How do I install the JDK?
    Thanks,
    Lightbulbjb

    The recommended way to install Java 8 on Debian is apt-get install openjdk-8-jre, but you'll have to wait until that package actually exists, which is not the case yet. Neither of the above ways you mention are recommended on Debian, but both should be working.

  • Graphical bugs after 10.6.4 update

    Graphical bugs after 10.6.4 update
    - If Adobe Bridge CS5 is opened and a flash video is played with Safari 5 the whole desktop Vsync will get disabled.
    - iTunes 9.2 CoverFlow showing corrupt images for blank cover art.
    - Google Earth showing corrupt image as viewport after opening a website from within the application.
    Examples of the Google Earth corrupt viewport (it's funny I can still see my bootcamp desktop even trough I have been into OS X for an hour):
    http://img203.imageshack.us/g/img0.png/

    Your MBP has a different graphics card, Sig - nVidia 9600M, rather than the nVidia 8600M that fjtorsol has.
    Fjtorsol, there are issues with the nVidia drivers in 10.6.4 being pretty buggy, but I'm not clear on exactly which Macs are affected.
    I would suggest running a Repair Permissions then reinstalling 10.6.4 from the combo update http://support.apple.com/kb/DL1048 to make sure that your system is correctly updated.
    If that doesn't work, your best bet is to revert to 10.6.3 until the graphics drivers are fixed.

  • Graphic bug in system preferences

    hi. when i open the sys preferences, i always have a graphic bug, with for example the printer icon squared and very big. any solutions? thanks

    Try trashing ~/Library/Preferences/com.apple.systempreferences.plist. (Quit System Preferences first.) If that doesn't work, try trashing ~/Library/Caches/com.apple.preferencepanes.cache.

  • Graphic bug with HTML5 video

    Hi,
    I am experiencing an ugly graphic bug in Safari 5.0.2. Looks like this: http://tinyurl.com/24cl9t8
    Occurs on this website: http://cargocollective.com/woodyholl when you open a project (girl on the beach for example)
    Background video is embedded via <video>, all layers above are relatively simple HTMLCSSjs. The project pages contain embedded videos (vimeo etc.) and javascript slideshows.
    Did this happen to anyone else? Is there a fix for it?
    Thanks in advance,
    Flo

    the bug occurs even with just a js-slideshow inside a project, no Flash involved
    Ah, I misunderstood.
    Of course, it might be a bug affecting some machines/OS builds - see http://bugreport.apple.com for that.
    If you want to track down a possible cause on your mac - another install/different boot disk should eliminate any software cause. Or there might be settings for the specific graphics card?.
    Certainly some graphics issues seem only to show with safari and/or flash, despite being a hardware problem at heart. The Mac Pro section here would be the place to explore that, with specific card details & after running the hardware test from dvd.

  • CDR-17066 RON cannot find java EWT graphics classes

    Hello,
    I am evaluating Oracle SCM. Everything's going great, except I am unable to use the Version History or Version Events. When I try, I get an error:
    "CDR-17066: RON cannot find java EWT graphics classes"
    The action it recommends is to check the registry or environment variable JVM_CLASSPATH_RON, and make sure it points to the ewt jar.
    I found a jar called ewt3.jar in my oracle/jlib directory. There was no environmental variable called JVM_CLASSPATH_RON, so I created one and set it to that jar. But I'm still getting the same error.
    Any help would be appreciated. Thank you.

    Hi,
    this error message is rather strange: I checked in our knwoledge base, but you seem to be the first one having this issue!
    I had a look to my registry and indeed I couldn't find the variable JVM_CLASSPATH_RON.
    I suspect that this variable was superseded by another one (JVM_CLASSPATH_DEFAULT_THIN_JDBC ?).
    I checked for all variables including ewt and found the following:
    . FORMS90_CLASSPATH (<Home>\jlib\ewt3.jar)
    . FORMS90_BUILDER_CLASSPATH (<Home>\jlib\ewt3.jar)
    . JVM_CLASSPATH_DEFAULT_THIN_JDBC (<Home>\jlib\ewt4.jar)
    FORMS90_... variables are not used by the Version History and Version Event Viewers, but JVM_CLASSPATH_DEFAULT_THIN_JDBC is.
    I removed the entry <Home>\jlib\ewt4.jar from JVM_CLASSPATH_DEFAULT_THIN_JDBC, and then I could reproduce your issue.
    So could you check the content of this variable JVM_CLASSPATH_DEFAULT_THIN_JDBC?
    It's located in HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\HOMEx\REPADM61\DEFAULT_JVM_PARAMS_THIN_JDBC
    Could you also check that file <Home>\jlib\ewt4.jar does exist on your machine?
    Regards,
    Didier.

  • I have Graphical bugs/problems in Lion

    I restored menubar icons after a small mod to them.
    Log back in and all off the sudden every field where I click is pink en loading icons are NOT how they should be!
    I can't restore with Time Machine because when I activate it, the graphical bugs are also there.
    Hopefully somebody will help me with this ;-)

    Sounds like your "small mod" damaged the system.  Try rebooting into recovery mode (hold down command-R at startup) and restore your entire system from the last Time Machine backup before you made that mod.  Alternately, if you don't want to restore everything, you could just reinstall the system from recovery mode, which will overwrite the current system with a new one, but leave all your apps and data alone.

  • Adding java 2d graphices to a JScrollPane

    How can I use the graphics 2d in a Java Applet JScrollPane?
    here is me code. I have a a ImageOps.java file that does a bunch of Java 2d, but I need it to fit into my applet's JScrollPane. Can anyone help me?
    package louis.tutorial;
    import java.awt.BorderLayout;
    import javax.swing.JPanel;
    import javax.swing.JApplet;
    import java.awt.Dimension;
    import javax.swing.JInternalFrame;
    import javax.swing.JButton;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.FlowLayout;
    import java.awt.GridLayout;
    import java.awt.Image;
    import java.awt.MediaTracker;
    import java.awt.Rectangle;
    import java.awt.Point;
    import javax.swing.JComboBox;
    import javax.swing.JList;
    import javax.swing.JTextArea;
    import javax.imageio.ImageIO;
    import javax.swing.Icon;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JLabel;
    import javax.swing.JMenuItem;
    import javax.swing.ImageIcon;
    import javax.swing.KeyStroke;
    import java.awt.FileDialog;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.awt.image.BufferedImage;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.File;
    import java.io.IOException;
    import java.net.URL;
    import javax.swing.JScrollPane;
    * Place class description here
    * @version 1.0
    * @author llakser
    public class ImageApplet extends JApplet {
    private JPanel jContentPane = null;
    private JPanel jpLower = null;
    private JButton JBFirst = null;
    private JButton JBPrevious = null;
    private JButton JBNext = null;
    private JButton JBLast = null;
    private JButton JBZoonIn = null;
    private JButton JBZoomOut = null;
    private JButton JBAnimate = null;
    private JButton JBPause = null;
    private JButton JBAutoRepeat = null;
    private JComboBox jcbFrameDelay = null;
    private BufferedImage image; // the rasterized image
    private Image[] numbers = new Image[10];
    private Thread animate;
    private MediaTracker tracker;
    private int frame = 0;
    private ImageIcon[] icon = null;
    private JFrame f = new JFrame("ImageOps");
    * This is the xxx default constructor
    public ImageApplet() {
         super();
    * This method initializes this
    * @return void
    public void init() {
         this.setSize(600, 600);
         this.setContentPane(getJContentPane());
         this.setName("");
         this.setMinimumSize(new Dimension(600, 600));
         this.setPreferredSize(new Dimension(600, 600));
    // f.addWindowListener(new WindowAdapter() {
    // public void windowClosing(WindowEvent e) {System.exit(0);}
    ImageOps applet = new ImageOps();
    //getJContentPane().add("Center", f);
    getJContentPane().add("Center", applet);
    //applet.add(f);
    applet.init();
    f.pack();
    f.setSize(new Dimension(550,550));
    f.setVisible(true);
    public void load() {
         tracker = new MediaTracker(this);
         for (int i = 1; i < 10; i++) {
         numbers[i] = getImage (getCodeBase (), i+".jpeg");//getImage(getDocumentBase(), "Res/" + i + ".gif");
         //Image img;
         //ico[i] = new ImageIcon(getCodeBase (), i+".jpeg");
         /* if (fInBrowser)
         img = getImage (getCodeBase (), "1.jpeg");
         else
         img = Toolkit.getDefaultToolkit ().getImage (
         "1.jpeg");*/
         tracker.addImage(numbers, i);
         try {
         tracker.waitForAll();
         } catch (InterruptedException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
         int i = 1;
         // for (int i = 1; i < 10; i++)
              icon[0] = new ImageIcon ("C:/images2/1.jpeg");//getImage(getDocumentBase(), "Res/" + i + ".gif");
              //icon[0] = new ImageIcon("C:/images2/1.jpg");
              //System.out.println("Made it after icon " + ico.toString());
              //ImageIcon ii = new ImageIcon("1.jpg");
              //jLabel = new JLabel(icon);
              //jLabel.setText("JLabel");
              //jLabel.setIcon(icon[0]);
         Graphics g = null;
              //g.drawImage(numbers[1],0,0,1500,1400,jScrollPane);
         //ImageIcon ii = new ImageIcon(numbers[2]);
         //this.jScrollPane.add(new JLabel(ii));// = new JScrollPane(new JLabel(ii));
         // System.out.println("Gee I made it..");
              //scroll.paintComponents(g);
              //paintComponents(g);
    public void paintComponents(Graphics g) {
    super.paintComponents(g);
    // Retrieve the graphics context; this object is used to paint shapes
    Graphics2D g2d = (Graphics2D)g;
    // Draw an oval that fills the window
    int width = this.getBounds().width;
    int height = this.getBounds().height;
    Icon icon = new ImageIcon("C:/images2/1.jpg");
    //jLabel.setIcon(icon);
    //g2d.drawImage(0,0,1500,1400);
    g2d.drawOval(10,20, 300,400);
    // and Draw a diagonal line that fills MyPanel
    g2d.drawLine(0,0,width,height);
    * This method initializes jContentPane
    * @return javax.swing.JPanel
    private JPanel getJContentPane() {
         if (jContentPane == null) {
         jContentPane = new JPanel();
         jContentPane.setLayout(new BorderLayout());
         jContentPane.setPreferredSize(new Dimension(768, 576));
         jContentPane.setMinimumSize(new Dimension(768, 576));
         jContentPane.setName("");
         jContentPane.add(getJpLower(), BorderLayout.SOUTH);
         return jContentPane;
    * This method initializes jpLower     
    * @return javax.swing.JPanel     
    private JPanel getJpLower() {
    if (jpLower == null) {
         try {
         jpLower = new JPanel();
         jpLower.setLayout(null);
         jpLower.setPreferredSize(new Dimension(500, 100));
         jpLower.setMinimumSize(new Dimension(500, 160));
         jpLower.add(getJBFirst(), null);
         jpLower.add(getJBPrevious(), null);
         jpLower.add(getJBNext(), null);
         jpLower.add(getJBLast(), null);
         jpLower.add(getJBZoonIn(), null);
         jpLower.add(getJBZoomOut(), null);
         jpLower.add(getJBAnimate(), null);
         jpLower.add(getJBPause(), null);
         jpLower.add(getJBAutoRepeat(), null);
         jpLower.add(getJcbFrameDelay(), null);
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return jpLower;
    * This method initializes JBFirst     
    * @return javax.swing.JButton     
    private JButton getJBFirst() {
    if (JBFirst == null) {
         try {
         JBFirst = new JButton();
         JBFirst.setText("First");
         JBFirst.setLocation(new Point(7, 7));
         JBFirst.setSize(new Dimension(59, 26));
         JBFirst.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent e) {
              System.out.println("First Button Clicked()");
         load();
              // TODO Auto-generated Event stub actionPerformed()
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBFirst;
    * This method initializes JBPrevious     
    * @return javax.swing.JButton     
    private JButton getJBPrevious() {
    if (JBPrevious == null) {
         try {
         JBPrevious = new JButton();
         JBPrevious.setText("Previous");
         JBPrevious.setLocation(new Point(69, 7));
         JBPrevious.setSize(new Dimension(94, 26));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBPrevious;
    * This method initializes JBNext     
    * @return javax.swing.JButton     
    private JButton getJBNext() {
    if (JBNext == null) {
         try {
         JBNext = new JButton();
         JBNext.setText("Next");
         JBNext.setLocation(new Point(166, 7));
         JBNext.setSize(new Dimension(66, 26));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBNext;
    * This method initializes JBLast     
    * @return javax.swing.JButton     
    private JButton getJBLast() {
    if (JBLast == null) {
         try {
         JBLast = new JButton();
         JBLast.setText("Last");
         JBLast.setLocation(new Point(235, 7));
         JBLast.setSize(new Dimension(59, 26));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBLast;
    * This method initializes JBZoonIn     
    * @return javax.swing.JButton     
    private JButton getJBZoonIn() {
    if (JBZoonIn == null) {
         try {
         JBZoonIn = new JButton();
         JBZoonIn.setText("Zoom In");
         JBZoonIn.setLocation(new Point(408, 7));
         JBZoonIn.setPreferredSize(new Dimension(90, 26));
         JBZoonIn.setSize(new Dimension(90, 26));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBZoonIn;
    * This method initializes JBZoomOut     
    * @return javax.swing.JButton     
    private JButton getJBZoomOut() {
    if (JBZoomOut == null) {
         try {
         JBZoomOut = new JButton();
         JBZoomOut.setBounds(new Rectangle(503, 7, 90, 26));
         JBZoomOut.setPreferredSize(new Dimension(90, 26));
         JBZoomOut.setText("Zoom Out");
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBZoomOut;
    * This method initializes JBAnimate     
    * @return javax.swing.JButton     
    private JButton getJBAnimate() {
    if (JBAnimate == null) {
         try {
         JBAnimate = new JButton();
         JBAnimate.setText("Animate");
         JBAnimate.setSize(new Dimension(90, 26));
         JBAnimate.setPreferredSize(new Dimension(90, 26));
         JBAnimate.setLocation(new Point(408, 36));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBAnimate;
    * This method initializes JBPause     
    * @return javax.swing.JButton     
    private JButton getJBPause() {
    if (JBPause == null) {
         try {
         JBPause = new JButton();
         JBPause.setPreferredSize(new Dimension(90, 26));
         JBPause.setLocation(new Point(503, 36));
         JBPause.setSize(new Dimension(90, 26));
         JBPause.setText("Pause");
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBPause;
    * This method initializes JBAutoRepeat     
    * @return javax.swing.JButton     
    private JButton getJBAutoRepeat() {
    if (JBAutoRepeat == null) {
         try {
         JBAutoRepeat = new JButton();
         JBAutoRepeat.setBounds(new Rectangle(446, 65, 106, 26));
         JBAutoRepeat.setText("Auto Repeat");
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return JBAutoRepeat;
    * This method initializes jcbFrameDelay     
    * @return javax.swing.JComboBox     
    private JComboBox getJcbFrameDelay() {
    if (jcbFrameDelay == null) {
         try {
         jcbFrameDelay = new JComboBox();
         jcbFrameDelay.setSize(new Dimension(156, 25));
         jcbFrameDelay.setName("Frame Delay");
         jcbFrameDelay.setLocation(new Point(7, 35));
         } catch (java.lang.Throwable e) {
         // TODO: Something
    return jcbFrameDelay;
    } // @jve:decl-index=0:visual-constraint="10,10"

    I think you've got it:
    public class ImageComponent extends JPanel { //or JComponent
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            //do your rendering here
    }The fact that ImageComponent sits inside JScrollPane is accidental, right?
    It should be able to function on its own, without a JScrollPane present, just as JTextArea can.
    So I'm not sure what your question is. Can you post a small (<1 page)
    example program demonstrating your problem.
    For example, here are a very few lines demonstrating what I am trying to say:
    import java.awt.*;
    import javax.swing.*;
    class CustomExample extends JPanel {
        public CustomExample() {
            setPreferredSize(new Dimension(800,800));
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.fillOval(0, 0, getWidth(), getHeight());
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    JFrame f = new JFrame("CustomExample");
                    f.getContentPane().add(new JScrollPane(new CustomExample()));
                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f.setSize(400,400);
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }Now you post your problem in a program that is just as short.

  • Is the Java "Zero-Day" bug dangerous for MountainLion users?

    Is the Java "Zero-Day" bug dangerous for MountainLion users?

    It is not yet dangerous, to my knowledge, as it is currently being used only to distribute Windows malware. But users of Java 7 are certainly vulnerable, should a hacker start distributing Mac malware through this vulnerability.
    For more info, see:
    http://www.reedcorner.net/new-unpatched-java-vulnerability-discovered/

  • Graphical bug

    Hi
    There is a graphical bug in new yosemite os, when you reduce the transparency. It is quite annoying. I hope it will be solved in the next update.

    +1

Maybe you are looking for