Advanced drawing of components

Hey all,
I have yet to see a really good book that explains in detail the various capabilities of the Graphics 2D. There are tons of capabilities, like Shape and all its subclasses, Transform, the many methods of Graphics2D, and so on. There are some VERY kick-ass possibilities yet it seems very few people understand how to use these more advanced features of Graphics2D.
As an example, I am trying to create a nice rounded, shadowed panel component with a gradient shadow and definable rounded corners with a definable arc. For the most part, it hasn't been difficult doing the rounded stuff, but trying to get the shadow just right, faded on the rounded curve, and so on has not been easy. I have tried many things, from using fillRoundRect, to fillArc, to looking at using clipping and compositing, possibly a Shape object, etc. I am no graphics expert, so the lack of docs/tutorials that explain how to really use the Graphics2D and all of its capabilities is disappointing. I almost feel I need to be a 2D/3D expert to understand the various features.
So, does anyone have any good links, or book suggestions that really explain Graphics2D and really delve into advanced drawing features, such as creating custom drawn components? Are there some free resources on the net to help out? If not, I will be happy to buy a good book or two.
I want to learn how to use Shape, Compositing, clipping, gradients, transforms, text and fonts, strokes, and so forth in good detail, enough that I can answer a good deal of questions posted in this forum and others and know how to attack a problem like a rounded shaded cornered panel component.
Speaking of, one concern I have with making a rounded panel is how to enforce that components added to the panel are within the inside rounded edges. Is this the job of insets()? I thought of using an internal panel and delegating all the add(), find(), get(), remove() and other methods of the JPanel that I extend (or JComponent), to the internal panel. I have also tried drawing the shadowed portion as a border, so that perhaps (hopefully) I dont need an internal panel component, as that seems a bit messy. But I surely don't want any components to be added that overlap the rounded edges. Any ideas on this?
Thanks

I have been thinking about using it as a border
instead of drawing it as a complete component. I think
that would allow the internal components to be added
to the panel without much fanfare of the rounded
border, although it may still pose a problem should
the rounded edges and shadow take up more space than
they should. I don't know much about insets, but I am
hoping by adjust the insets that the add() methods
would use those to place components within the inset
range and not the entier 0,0,width,height of the panel
itself.That's the job of the layout manager -- if it is stretching components to fill a panel, it should
know about the (left, top, bottom, right) gaps of the insets as dictated by the border and place
components not within rectangle (0, 0, width, height) but within rectangle
(left, top, width-left-right, height-top-bottom).
That being said, I wish I had a nickel for every time I read someone's custom component method,
where their paintComponent assumes that can draw at (0,0) -- no realizing they have to offset for the
insets of the border!
A demo that shows GridLayout knows about borders:
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class ExampleBorder implements Border {
    private int thickness;
    private Color color;
    ExampleBorder(int thickness, Color color) {
        this.thickness = thickness;
        this.color = color;
    public Insets getBorderInsets(Component c) {
        return new Insets(thickness, thickness, 0, 0);
    public boolean isBorderOpaque() {
        return false;
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        Color oldColor = g.getColor();
        g.setColor(color);
        if (width > thickness)
            g.fillRect(x, y, width-thickness, thickness);
        if (height > thickness)
            g.fillRect(x, y, thickness, height-thickness);
        g.setColor(oldColor);
    //convenience
    public JComponent wrap(JComponent comp) {
        Border old = comp.getBorder();
        if (old == null)
            comp.setBorder(this);
        else
            comp.setBorder(BorderFactory.createCompoundBorder(this, old));
        return comp;
    //sample main
    public static void main(String[] args) {
        ExampleBorder panelB = new ExampleBorder(6, Color.BLUE);
        ExampleBorder compB = new ExampleBorder(2, Color.RED);
        JPanel cp = new JPanel(new GridLayout(2, 2, 1, 1));
        //cp.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
        panelB.wrap(cp);
        cp.add(compB.wrap(new JButton("alpha")));
        cp.add(compB.wrap(new JButton("beta")));
        cp.add(compB.wrap(new JButton("gamma")));
        cp.add(compB.wrap(new JButton("delta")));
        JFrame f = new JFrame("X");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setContentPane(cp);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);

Similar Messages

  • CS6 - Advanced Drawing Mode - Problem

    Hello Everyone'
    I just got a new Dell XPS 8500 with a solid state drive and 16 gigs of RAM but..
    I've encounted an issue.. When using 'Advanced Drawing Mode' which was the default setting, the edit tools such as 'Free Transform' turns my canvas white so I can't see the image nor the edit tool's guides. When I hit enter or exist the edit tool the image re-appears. Everything else including the rotate canvas and animated zoom works fine.
    If I change my Drawing Mode from Advanced to Normal under Performance and Advanced Settings the problme is fixed. But, I figured with the new computer I just bought it should be able to handle photoshop at its highest settings.
    Does anybody have any tips for this??
    Thanks!
    -Joshua
    System Info
    Adobe Photoshop Version: 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00) x64
    Operating System: Windows 7 64-bit
    Version: 6.1 Service Pack 1
    System architecture: Intel CPU Family:6, Model:10, Stepping:9 with MMX, SSE Integer, SSE FP, SSE2, SSE3, SSE4.1, SSE4.2, HyperThreading
    Physical processor count: 4
    Logical processor count: 8
    Processor speed: 3395 MHz
    Built-in memory: 16347 MB
    Free memory: 10856 MB
    Memory available to Photoshop: 14717 MB
    Memory used by Photoshop: 60 %
    Image tile size: 128K
    Image cache levels: 4
    OpenGL Drawing: Enabled.
    OpenGL Drawing Mode: Normal
    OpenGL Allow Normal Mode: True.
    OpenGL Allow Advanced Mode: True.
    OpenGL Allow Old GPUs: Not Detected.
    Video Card Vendor: ATI Technologies Inc.
    Video Card Renderer: AMD Radeon HD 7800 Series
    Display: 2
    Display Bounds:=  top: 0, left: 0, bottom: 1200, right: 1600
    Display: 1
    Display Bounds:=  top: 0, left: -1680, bottom: 1050, right: 0
    Video Card Number: 1
    Video Card: AMD Radeon HD 7800 Series
    OpenCL Version:
    Driver Version: 8.932.4.2000
    Driver Date: 20120222000000.000000-000
    Video Card Driver: aticfx64.dll,aticfx64.dll,aticfx64.dll,aticfx32,aticfx32,aticfx32,atiumd64.dll,atidxx64.d ll,atidxx64.dll,atiumdag,atidxx32,atidxx32,atiumdva,atiumd6a.cap,atitmm64.dll
    Video Mode: 1680 x 1050 x 4294967296 colors
    Video Card Caption: AMD Radeon HD 7800 Series
    Video Card Memory: 2048 MB
    Video Rect Texture Size: 16384
    Serial number: 91198543306202363891
    Application folder: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\
    Temporary file path: C:\Users\JtJ\AppData\Local\Temp\
    Photoshop scratch has async I/O enabled
    Scratch volume(s):
      C:\, 226.2G, 157.4G free
    Required Plug-ins folder: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Required\
    Primary Plug-ins folder: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Plug-ins\
    Additional Plug-ins folder: not set
    Installed components:
       A3DLIBS.dll   A3DLIB Dynamic Link Library   9.2.0.112  
       ACE.dll   ACE 2012/01/18-15:07:40   66.492997   66.492997
       adbeape.dll   Adobe APE 2012/01/25-10:04:55   66.1025012   66.1025012
       AdobeLinguistic.dll   Adobe Linguisitc Library   6.0.0  
       AdobeOwl.dll   Adobe Owl 2012/02/09-16:00:02   4.0.93   66.496052
       AdobePDFL.dll   PDFL 2011/12/12-16:12:37   66.419471   66.419471
       AdobePIP.dll   Adobe Product Improvement Program   6.0.0.1654  
       AdobeXMP.dll   Adobe XMP Core 2012/02/06-14:56:27   66.145661   66.145661
       AdobeXMPFiles.dll   Adobe XMP Files 2012/02/06-14:56:27   66.145661   66.145661
       AdobeXMPScript.dll   Adobe XMP Script 2012/02/06-14:56:27   66.145661   66.145661
       adobe_caps.dll   Adobe CAPS   6,0,29,0  
       AGM.dll   AGM 2012/01/18-15:07:40   66.492997   66.492997
       ahclient.dll    AdobeHelp Dynamic Link Library   1,7,0,56  
       aif_core.dll   AIF   3.0   62.490293
       aif_ocl.dll   AIF   3.0   62.490293
       aif_ogl.dll   AIF   3.0   62.490293
       amtlib.dll   AMTLib (64 Bit)   6.0.0.75 (BuildVersion: 6.0; BuildDate: Mon Jan 16 2012 18:00:00)   1.000000
       ARE.dll   ARE 2012/01/18-15:07:40   66.492997   66.492997
       AXE8SharedExpat.dll   AXE8SharedExpat 2011/12/16-15:10:49   66.26830   66.26830
       AXEDOMCore.dll   AXEDOMCore 2011/12/16-15:10:49   66.26830   66.26830
       Bib.dll   BIB 2012/01/18-15:07:40   66.492997   66.492997
       BIBUtils.dll   BIBUtils 2012/01/18-15:07:40   66.492997   66.492997
       boost_date_time.dll   DVA Product   6.0.0  
       boost_signals.dll   DVA Product   6.0.0  
       boost_system.dll   DVA Product   6.0.0  
       boost_threads.dll   DVA Product   6.0.0  
       cg.dll   NVIDIA Cg Runtime   3.0.00007  
       cgGL.dll   NVIDIA Cg Runtime   3.0.00007  
       CIT.dll   Adobe CIT   2.0.5.19287   2.0.5.19287
       CoolType.dll   CoolType 2012/01/18-15:07:40   66.492997   66.492997
       data_flow.dll   AIF   3.0   62.490293
       dvaaudiodevice.dll   DVA Product   6.0.0  
       dvacore.dll   DVA Product   6.0.0  
       dvamarshal.dll   DVA Product   6.0.0  
       dvamediatypes.dll   DVA Product   6.0.0  
       dvaplayer.dll   DVA Product   6.0.0  
       dvatransport.dll   DVA Product   6.0.0  
       dvaunittesting.dll   DVA Product   6.0.0  
       dynamiclink.dll   DVA Product   6.0.0  
       ExtendScript.dll   ExtendScript 2011/12/14-15:08:46   66.490082   66.490082
       FileInfo.dll   Adobe XMP FileInfo 2012/01/17-15:11:19   66.145433   66.145433
       filter_graph.dll   AIF   3.0   62.490293
       hydra_filters.dll   AIF   3.0   62.490293
       icucnv40.dll   International Components for Unicode 2011/11/15-16:30:22    Build gtlib_3.0.16615  
       icudt40.dll   International Components for Unicode 2011/11/15-16:30:22    Build gtlib_3.0.16615  
       image_compiler.dll   AIF   3.0   62.490293
       image_flow.dll   AIF   3.0   62.490293
       image_runtime.dll   AIF   3.0   62.490293
       JP2KLib.dll   JP2KLib 2011/12/12-16:12:37   66.236923   66.236923
       libifcoremd.dll   Intel(r) Visual Fortran Compiler   10.0 (Update A)  
       libmmd.dll   Intel(r) C Compiler, Intel(r) C++ Compiler, Intel(r) Fortran Compiler   10.0  
       LogSession.dll   LogSession   2.1.2.1640  
       mediacoreif.dll   DVA Product   6.0.0  
       MPS.dll   MPS 2012/02/03-10:33:13   66.495174   66.495174
       msvcm80.dll   Microsoft® Visual Studio® 2005   8.00.50727.6195  
       msvcm90.dll   Microsoft® Visual Studio® 2008   9.00.30729.1  
       msvcp100.dll   Microsoft® Visual Studio® 2010   10.00.40219.1  
       msvcp80.dll   Microsoft® Visual Studio® 2005   8.00.50727.6195  
       msvcp90.dll   Microsoft® Visual Studio® 2008   9.00.30729.1  
       msvcr100.dll   Microsoft® Visual Studio® 2010   10.00.40219.1  
       msvcr80.dll   Microsoft® Visual Studio® 2005   8.00.50727.6195  
       msvcr90.dll   Microsoft® Visual Studio® 2008   9.00.30729.1  
       pdfsettings.dll   Adobe PDFSettings   1.04  
       Photoshop.dll   Adobe Photoshop CS6   CS6  
       Plugin.dll   Adobe Photoshop CS6   CS6  
       PlugPlug.dll   Adobe(R) CSXS PlugPlug Standard Dll (64 bit)   3.0.0.383  
       PSArt.dll   Adobe Photoshop CS6   CS6  
       PSViews.dll   Adobe Photoshop CS6   CS6  
       SCCore.dll   ScCore 2011/12/14-15:08:46   66.490082   66.490082
       ScriptUIFlex.dll   ScriptUIFlex 2011/12/14-15:08:46   66.490082   66.490082
       tbb.dll   Intel(R) Threading Building Blocks for Windows   3, 0, 2010, 0406  
       tbbmalloc.dll   Intel(R) Threading Building Blocks for Windows   3, 0, 2010, 0406  
       TfFontMgr.dll   FontMgr   9.3.0.113  
       TfKernel.dll   Kernel   9.3.0.113  
       TFKGEOM.dll   Kernel Geom   9.3.0.113  
       TFUGEOM.dll   Adobe, UGeom©   9.3.0.113  
       updaternotifications.dll   Adobe Updater Notifications Library   6.0.0.24 (BuildVersion: 1.0; BuildDate: BUILDDATETIME)   6.0.0.24
       WRServices.dll   WRServices Friday January 27 2012 13:22:12   Build 0.17112   0.17112
       wu3d.dll   U3D Writer   9.3.0.113  
    Required plug-ins:
       Accented Edges 13.0
       Adaptive Wide Angle 13.0
       ADM 3.11x01
       Angled Strokes 13.0
       Average 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Bas Relief 13.0
       BMP 13.0
       Camera Raw 7.0
       Chalk & Charcoal 13.0
       Charcoal 13.0
       Chrome 13.0
       Cineon 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Clouds 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Collada 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Color Halftone 13.0
       Colored Pencil 13.0
       CompuServe GIF 13.0
       Conté Crayon 13.0
       Craquelure 13.0
       Crop and Straighten Photos 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Crop and Straighten Photos Filter 13.0
       Crosshatch 13.0
       Crystallize 13.0
       Cutout 13.0
       Dark Strokes 13.0
       De-Interlace 13.0
       Difference Clouds 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Diffuse Glow 13.0
       Displace 13.0
       Dry Brush 13.0
       Eazel Acquire 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Embed Watermark 4.0
       Extrude 13.0
       FastCore Routines 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Fibers 13.0
       Film Grain 13.0
       Filter Gallery 13.0
       Fresco 13.0
       Glass 13.0
       Glowing Edges 13.0
       Grain 13.0
       Graphic Pen 13.0
       Halftone Pattern 13.0
       HDRMergeUI 13.0
       IFF Format 13.0
       Ink Outlines 13.0
       JPEG 2000 13.0
       Lens Blur 13.0
       Lens Correction 13.0
       Lens Flare 13.0
       Liquify 13.0
       Matlab Operation 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Measurement Core 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Mezzotint 13.0
       MMXCore Routines 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Mosaic Tiles 13.0
       Multiprocessor Support 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Neon Glow 13.0
       Note Paper 13.0
       NTSC Colors 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Ocean Ripple 13.0
       Oil Paint 13.0
       OpenEXR 13.0
       Paint Daubs 13.0
       Palette Knife 13.0
       Patchwork 13.0
       Paths to Illustrator 13.0
       PCX 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Photocopy 13.0
       Photoshop 3D Engine 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Picture Package Filter 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Pinch 13.0
       Pixar 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Plaster 13.0
       Plastic Wrap 13.0
       PNG 13.0
       Pointillize 13.0
       Polar Coordinates 13.0
       Portable Bit Map 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Poster Edges 13.0
       Radial Blur 13.0
       Radiance 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Read Watermark 4.0
       Reticulation 13.0
       Ripple 13.0
       Rough Pastels 13.0
       Save for Web 13.0
       ScriptingSupport 13.0
       Shear 13.0
       Smart Blur 13.0
       Smudge Stick 13.0
       Solarize 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Spatter 13.0
       Spherize 13.0
       Sponge 13.0
       Sprayed Strokes 13.0
       Stained Glass 13.0
       Stamp 13.0
       Sumi-e 13.0
       Targa 13.0
       Texturizer 13.0
       Tiles 13.0
       Torn Edges 13.0
       Twirl 13.0
       Underpainting 13.0
       Vanishing Point 13.0
       Variations 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Water Paper 13.0
       Watercolor 13.0
       Wave 13.0
       WIA Support 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       Wind 13.0
       Wireless Bitmap 13.0 (13.0 20120315.r.428 2012/03/15:21:00:00)
       ZigZag 13.0
    Optional and third party plug-ins: NONE
    Plug-ins that failed to load: NONE
    Flash:
       Mini Bridge
       Kuler
    Installed TWAIN devices: NONE

    Video Card Renderer: AMD Radeon HD 7800 Series
    Video Card: AMD Radeon HD 7800 Series
    OpenCL Version:
    Driver Version: 8.932.4.2000
    Driver Date: 20120222000000.000000-000
    Your new computer is plenty powerful, but the software on it is 6 months old.
    Visit the AMD web site and seek an updated display driver to match your hardware and OS.  Download and install that (I think the current version is still Catalyst 12.6) and you'll very likely have all the Advanced facilities in working order.
    -Noel

  • Using Open GL/ Advanced Drawing with HDR

    Hey all -
    I've just switched to using Vista and now have a new vid card (GTX285) so I'm using the OpenGL stuff for the first time. I can't get my head around how to use the Debugging section to get accurate results with linear data images.
    I'm looking at 32bit .exr renders and normally they have a gamma of 1 and I make adjustments in Pshop before going to 8bit, but how what setting in the Advanced Drawing settings can I trust?  Depending on what I have set there the image looks very different, but also converts to 8 bit looking very different.
    What is the default workfflow setup that best matches what CS4 does *without* the OpenGL stuff active - but still makes use of the acceleration? The documentation on that stuff is pretty thin.
    Thanks
    b

    Truly appreciate your input.  Thanks.  I will try instalation of Catalyst 11.7 after removal of 11.11 and return to you soon of results.  Thanks, again.
    From: Noel Carboni <[email protected]>
    To: aldpal <[email protected]>
    Sent: Wednesday, November 30, 2011 8:09 AM
    Subject: Open GL Advanced Mode?
    Re: Open GL Advanced Mode? created by Noel Carboni in Photoshop Windows - View the full discussion
    I do not know why the Radeon HD 4600 should not provide Photoshop with the features it expects to see to be able to enable OpenGL.  The crop tool behaving badly could be another indication of a display driver problem.
    It's possible the 11.11 driver for that particular card has a bug, or that something else installed on your system is interfering with OpenGL operation.  You're using an older (but not ancient) card on an outdated operating system, so it's possible the driver developers could have concentrated more on other things (e.g., Windows 7 operation) during their development.
    Some things you could try:
    Check for any other software, such as a remote accesss package (e.g., where you or someone could log in to your system from the network) that could interfere with OpenGL operation.
    Remove the Catalyst 11.11 driver, reboot, and install an older version (I suggest trying 11.7, which seemed very stable).
    -Noel
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4054788#4054788
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4054788#4054788. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Windows by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Drawing swing components

    I should know how to do this!!
    How can I draw a swing component i.e. a JLabel, onto a panel (in this case a BufferedImage) using the Graphics package?
    Thanks!
    Alastair

    I've tried the JLabel.paint() method, but it doesn't seem to be working.
    Here is the complete code:
         public static void main(String[] args)
              BufferedImage bi = new BufferedImage(500, 400, BufferedImage.TYPE_INT_RGB);
              Graphics g = bi.getGraphics();
              Color backgroundColor = new Color(210,241,239);
              g.setColor(backgroundColor);
              g.fillRect(0,0,500,400);
              Color titleBarColor = new Color(205,251,174);
              g.setColor(titleBarColor);
              g.fillRect(0,0,500,27);
              g.setColor(Color.BLACK);
              JLabel theLabel = new JLabel();          
              theLabel.setText("Name:");
              theLabel.setLocation(100,100);
              theLabel.paint(g); 
              try
                   File outputFile = new File("c:\\output.PNG");
                   RenderedImage renderedImage = bi;
                   ImageIO.write(renderedImage, "png", outputFile);
              catch(Exception e)
                   System.out.println(e);
         }When I open the image outputed, the label doesn't seem to have been painted to it...

  • Drawing new components

    Here's a question that's plaguing me.
    What should I do if I wanted to draw a component(either applet or Swing and maybe both) differently from what it used to be?
    For example, I want my button not to be rectangular but circular(doesn't have a rectangular border of course!)
    Do I override some method? Which is it?

    here's a good example: http://java.sun.com/products/jfc/tsc/articles/swing2d/index.html

  • Drawing multiple components flicker

    I am trying to draw a number of Checkboxes in a Frame. The problem is that it flickers really badly. Is there a good way to solve this problem.
    /mad

    make it double buffered,
    but I don't think it's possible with the default objects
    so u should use an extended canvase to draw the checkboxes in
    class DoubleBufCheckBoxes extends Canvas
      public void paint( Graphics g )
        //create double buffer memory
        if( ( db == null ) || ( getWidth() != dbwidth ) || ( getHeight() != dbheight ) )
         dbwidth  = getWidth();
         dbheight = getHeight();
         dbImage  = Image.createImage(dbwidth, dbheight);
         db = dbImage.getGraphics();
         //draw your own checkboxes in db
         db.draw..etc etc
         //draw the buffer to the screen
         g.drawImage( dbImage, 0, 0, Graphics.TOP|Graphics.LEFT );
    }

  • Drawing New Components too Late?

    Hello everyone,
    I have a snippet of code here involving a 'please wait' sheet. Similar to a loading screen i would imagine.
    if (player.getComponent() != null)
       JFileChooser fc = new JFIleChooser();
       int FCVal = fc.showSaveDialog(this);
       if (FCVal == JFileChooser.APPROVE_OPTION)
          su.showSheet();
          player.produceJPEGSnapShot();
          su.hideSheet();
    }The problem lies in the su.showSheet(); Where the method draws a 'sheet' frame onto the main UI frame, as a JInternalFrame. It does do it, however it seems to 'wait' to draw it until this current thread is free. And thus not actually showing anything. I have tried wrapping a new thread around this as well, same result.
    produceJPEGSnapShot() is a method that takes a good 2-3 seconds to complete.
    Anyone know any other way to do this?

    You'll likely need to use a background non-EDT thread to do your busy work. Something like so:
        if (player.getComponent() != null)
           JFileChooser fc = new JFileChooser();
           int FCVal = fc.showSaveDialog(this);
           if (FCVal == JFileChooser.APPROVE_OPTION)
              su.showSheet();
              // the background thread starts here
              new Thread(new Runnable()
                public void run()
                  player.produceJPEGSnapShot(); // do this off of the EDT
                  SwingUtilities.invokeLater(new Runnable()
                    public void run()
                      su.hideSheet();  // do this on the EDT but only *after* player finishes his thing
              }).start();
        }Edited by: Encephalopathic on Jun 12, 2008 2:04 PM

  • JLayerPane draws random components from different layers.

    Hello,
    I am running the latest version of JAVA 1.6 on Mac OS X. I am using JLayerPane and I have three panels where. The problem is that when application starts it draws JTextFields from the third layer, but they don't work. When I go to the last panel (the third) one, I just let's say open my Skype it draws JButton's from the second layer and judging from working effects they do work. Any ideas what's wrong?
    David

    For more help create a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://sscce.org], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • UI Components Problems

    How can i give a UI Component such as a text field a var
    name?
    Thanks in advance.

    Flex redraws components only when it is required to redraw so it's efficient and fast. If a custom component written in AS, not MXML, does not let the container know that it needs to be redrawn, sometimes it will not draw it at all and just leave it white. When you move your mouse over the components, flex knows that stuff under the cursor needs to be redrawn when it moves away, so it redraws it. That's how I understand it anyway
    and about placing the invalidateDisplayList() call, try putting it in the tabnavigator's tabIndexChange="tabNavigator.invalidateDisplayList()" maybe it will work

  • Macbook Retina 13"- slow drawing?

    Photoshop CS6 Extended 13.0.4 x64
    Macbook Pro Retina 13", Intel HD Graphics 4000, Mac OSX 10.8.3
    Hello, I installed Photoshop on my brand new Macbook and was surprised at how slow it was with retouching/drawing - eg signing my name with a paintbrush is laggy.
    I looked into the performance settings, and the only way to fix it seems to be switching the drawing mode from the default of Advanced to Basic, but I understand this isn't desirable as it ties up the CPU rather than utilising the more optimised/efficient graphics card.
    I wondered if this is normal or do I maybe have an issue that needs fixing?
    Thanks

    I appreciate your underlying point, but swirling a paintbrush around is hardly a voyage to the moon.
    Intel Graphics set to Advanced Drawing mode manage this basic task fine on my old standard-res machine, and they zip along with equal immediacy if I run Photoshop in "low-resolution mode" on the Retina
    The question is why do I see such a lag in retina mode?
    The obvious answer is because we are at 4 times the resolution, but if I enable the full-blown native resolution of my retina display in the OS (with QuickRes tool), Photoshop now occupies 1/4 of the screen and is essentially rendering like a non-retina Macbook.....but the lag is still there.
    I just wanted to know first and foremost whether this is what other 13" Retina users experience or if I had an issue with my machine or configuration. Thanks.

  • GUI Components & Graphical drawings

    Hi,
    I�m new to Swing (haven�t done much GUI since Motif!) and I�m a little confused about the relationship between GUI components and �drawn� graphics.
    In my application I have two JPanels � an upper and a lower � that display two views of the same data,
    In both of these JPanels I do my graph drawing using g.drawXXX() or g.fillXXX().
    I label the displays using g.drawString()
    However, I want to add some checkboxes to one of the JPanel displays that will trigger actions in the other JPanel. I�m not sure how to get the checkboxes to show up in the right place. It feels like the GUI components work in Layout mode whereas the graphics are in x,y coordinate space.
    I see that JComponent has setLoaction / setBounds methods � but I�ve not had any joy with these so far.
    I can see that I could create my own JComponent subclass that has the GUI and the graphics area and this could use a Layout to line things up.
    Basically � can I draw GUI components at an x,y coordinate on a JPanel?
    If this sounds like bad practice I�d welcome any sources of reference.
    Many thanks.

    Hi,
    My question probably sounds more complicated than it is owing to my inexperience with Swing. I'm sure what I'm after is done thousands of time in other apps.
    Bascially I have two set of graphs -
    One is pure graphical (plotting stock prices etc.).
    The other contains horizontal "bar" format data that lines up below the stock price graph
    (Again see latest posting here : http://www.chriswardsweblog.blogspot.com/)
    What I'm after is to have some controls at the right hand end of each bars. Presently I would imagine these to be a JCheckBox and maybe a JLabel to replace the g.drawString() rendered label in the screenshot.
    The reason I want this is that the upper graph area shows a plotted view of the bar data. I want to be able to check/uncheck the box to see the plotted quote lines turn on/off.
    I am pretty sure that I need to divide that lower JPanel into a "Graphical" panel for the bars and a "Component" panel for the controls. That feels like the correct thing to do - I just wanted someone to confirm I wasn't getting the wrong end of ths stick.
    If this is the case - I think I need to sort out what Layout I should use that will allow me to get the JCheckbox & JLabel to line up with the bars. I have been look at the Box layout which would seem to allow me to do that.
    I have another open question in this forum about how to toggle the visibilty of the upper panel quote lines - maybe that's where I need a Glass Panel?
    Does this clarify things?
    Thanks for all help.

  • Putting Components on top of other components

    Hi,
    I need some help with the following subject:
    from the super-class i need to place a component on top of all other components (or paint something on top of these), but when i add the component it shows below all other components.
    How can I make this work?

    sorry, but this was a little to essential.
    1. how does the paint method of the VXComponent look like?
    2. where and how do you add the other components, which are drawn on top of your component?
    3. actually you seem to use no LayoutManager?
    - I never did that but I'd guess it causes the container to draw the components just in the (reverse?) order in which they where added.
    if this is the case something like this should help:
    add(vx, 0),
    or
    add(vx, getComponentCount()-1);
    regards
    Spieler

  • What are XI objetcs and What are XI components

    there are so many areas in XI. for eg. ...IR,ID,SLD,RWB,IS,BPM blah blah...
    anyone please explain.... what is the diffrence between object and component.please explain in words rather giving link...
    thanx in advance.

    hey sam,
    components of xi are what xi is made of... like ir, id , rwb, sld, AE...these components sit on abap or java stack.
    "objects" in xi is what "you develope" to send/receive msg in xi like data types, msg types, mappings etc.
    plz refer help.sap. everything is documented pretty well over there.
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
    happy learning!
    [reward if helpful]
    regards,
    latika.

  • Simple drawing/sketch(/chat) solution, 2 computers simultaneously

    Hi!
    Topic already says it: I'm searching for a simple drawing/sketch/chat solution, 2 computers simultaneously. Priority about like this:
    1) Simplicity
    2) Responsiveness
    3a) Would be neat to have two working, independent mouse pointers & keyboard "foci" that work at the same time and visible on both PC's
    3b) Well, one shared pointer would do it, too then I'd use irc or something to "coordinate"
    X) advanced drawing / networking features I don't really need, but as long as they don't get in the way...
    I'm not planning on drawing a masterpiece with that, nor do I want to set up an encrypted server that allows 1000 people to draw at once - just two computers, simple sketches, simultaneously.
    Now...: What's the solution for this that fits best?
    - should I just try to figure out how to have X-windows in general register with two x-servers at once and use GIMP - although I don't need even one 10th its abilities for this? I don't know yet if it's possible/intended to do that like this, but if it is and someone can tell me a good search term, google should be able to teach me.
    - Is there some program that is really specialised on doing something like that? All I could find were various "online - pen&paper - chat/sketch/rolldice"-tools and none of them looked too comforting (plus: they mostly look a bit... silly... for a more general purpose, but that shall not hold me back nor shall the "random treasure chest" menu entry, for I have to power to just ignore it! ) but if someone can recommend a specific one that is suited well, I'll give it a try!
    - Anything else that can help me find the right way for me to do that?
    Thanks!
    Last edited by whoops (2009-07-07 12:13:41)

    You should search thru this or the AS3 forum for a posting from last year (or several from the same person) looking to do what you wanted to do.  I believe multiple postings resulted from this person refusing to accept they wouldn't be able to do it, or at least that no one was going to take the time to figure out a solution and give it away.  Logistically and technically it would be a complex design if it could be implemented.

  • CS4 is Constantly disabling GPU enhancements

    Each time I open CS4 and the initial image I get this message, "Photoshop has encountered a problem with the display driver, and has temporarily disabled GPU enhancements. Check the video card manufacturer's website for the latest software."
    I'm writing to the Adobe Forum because GeForce feels they are not the cause of the problem. Here is what I've done toward resolving this problem:
    As a side note let me add here that after upgrading CS2 to CS4 this error message appeared religiously. That caused me to purchased an Nvidia GeForce 9600 GT display adapter w/ 512mb memory. Prior to installing the new card I downloaded their newest drivers for this card after removing the old drivers. Originally I had a GeForce 7600 card. The error message continued with the new card. I've searched the settings within CS4 trying to find an option that would resolve the problem. This machine has a new motherboard, a D945GNT Intel board. It will support 64-bit however I'm currently running XP Pro 32-bit, SP3. It also has a new Pentium D dual core processor. I have 4 GB of RAM.
    Have I overlooked a setting in the CS4 program that will resolve the issue? The graphics are slow to regenerate if you move in or out. Bridge is slow to generate all images in folders. As I view the tutorials on the Net I see normal regens where mine are slow. And last but certainly not least, other programs are slow to open. I've done several virus scans and turned up nothing. I've run chkdsk /r on all of my drives. I've run defrag on all my drives as well as Disk Cleanup.
    I've got a copy of Vista Ultimate heading my way. I'm prepared to wipe the c-drive and begin over. Do you think my problems will go away after the new operating system in installed or is this my second bad 9600 GT video card?

    Folks,
    I tested several older and newer cards with the new CS4 enhancements on Win XP SP3 workstations. Here my lowdown (or 2 cents):
    Issues on all cards, no matter what:
    -All cards did have the one issue when displaying an image on a 2nd monitor: Background showing through. Just maximize the image window and the problem is gone. This happens to all my 6 video cards, no matter what driver, brand or GPU!
    How to avoid the "GPU Message" and reduce drawing issues:
    Here two cards that deliver a pretty decent price/performance (nothing is perfect, really). Key: The DEVIL IS IN THE GPU SETTINGS DETAILS! With these settings, we had a good performance with brushes, clone/healing, zooming and NO MORE GPU MESSAGE:
    NVidia GeForce 8600 - 512MB
    Use the following settings, and the error messages are gone:
    -Vertical Sync: Yes
    -3D Interaction: Blank/Disabled
    -Force Bilinear Interpolation: No
    -Advanced Drawing: Yes
    -Use for Image Display: Yes
    -Color Matching: Yes
    ATI Radeon 4670 - 1GB
    -Vertical Sync: No
    -3D Interaction: Blank/Disabled
    -Force Bilinear Interpolation: No
    -Advanced Drawing: Yes
    -Use fro Image Display: No
    -Color Matching: Yes
    I really believe that you will encounter issues no matter what brand, type or age of GPU you're using. The Trick is to find the perfect GL settings for your card. Based on my research, the OS seems to have no impact.
    Hope this helps,
    Cheers,
    Bruno

Maybe you are looking for