JFrame Icon problem

Hi I have manage to create a JFrame Icon & display it properly by running java <filename>.java it did show the frame & icon. But when i Put it into a JAR file, it cannot locate the Icon anymore (the icon folder are also in the jar file). How do I ask my testFrame.java file reference the icon in the jar file?

try doing it this way
import java.net.URL;
import java.awt.*;
import javax.swing.*;
import javax.imageio.ImageIO;
class Testing extends JFrame
  public Testing()
    Image img;
    try
      URL url = new URL(getClass().getResource("Save.gif"), "Save.gif");
      if (url != null)
        img = ImageIO.read(url);
        setIconImage(img);
    catch(Exception e){/*do nothing - default will display*/}
    setSize(100,100);
    setLocation(400,300);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    JPanel p = new JPanel();
    getContentPane().add(p);
  public static void main(String[] args){new Testing().setVisible(true);}
}

Similar Messages

  • JFrame Icon issues

    My entire program resides in a JAR.
    I am trying to change the icon in the upper left corner of the frame (it is a JFrame). I have tried various methods, including but probably not limited to:
    myFrame.setIconImage(Toolkit.getDefaultToolkit().getImage("my_image.gif"));
    myFrame.setIconImage(new ImageIcon(Main.class.getResource("my_image.gif")).getImage())
    myFrame.Toolkit.getDefaultToolkit().createImage((getClass().getResource("/my_image.png")))Anyways, every time I launch the program, the coffee cup remains. I have successfully modified my JInternalFrames in the same way, however they used the setFrameIcon() method instead of the setIconImage() method, which seems to have made some sort of difference.
    Any help is greatly appreciated,
    -sdo

    To quickly save some time I will list some probable suggestions:
    The images are in the JAR, they are not in a separate directory from my class files.
    I am using vista, I'm not sure if that makes a difference, but I vaguely remember reading something about there being icon problems with the Vista L&F.
    I tried making a separate method for reading the image, and went to the extent of catching IOExceptions and printing them to the screen (read: I'm getting IO exceptions when I try to do bring in the images). I'm not sure if this happens for all of the methods I tried, but it did happen for this one:
         public static Image getImageFromFile(String s) {
              Image i = null;
              File f = new File(s);
              try {
                   i = ImageIO.read(f);
              } catch (IOException e) {
                   System.out.println("Bad things happened");
              return i;
         }Edited by: sdoking on Jan 13, 2008 5:33 AM

  • Icon Problem vs Warranty

    The icon problem happened to me and after trying everything I put it in a Apple dealer. Is this type problem included in the Warranty? The product just had 3 weeks and it stoped working properly. The dealer says I have to pay the repair.
    Thank you.

    I've also tried that. The iPod is already in repair and the retailer said I had to pay, I was just seeing if I had the right to argue on this subject. Guess not.
    Thank you for your help. It's a shame that so many people are having these problems and Apple still has no answer.
    Well hope the next one to buy has more luck or chooses another product.
    Thank you once more.

  • Incorrect JFrame icon display with custom theme

    I created a JFrame with custom icon and theme.
    The problem is the transparent color of icon
    doesnt not display correctly.
    Can anyone help?

    Hi,
    As you said, the custom theme appears when applying seatle.master page, but not when applying a custom master page.
    It might be an issue of this custom master page.
    As a common practice, I would suggest you inspect the “Change the look” page source code when applying the seatle.master page using IE Developer Tools, compare it
    with the page when applying that custom master page, to see if it will give you more information about this issue.
    Another suggestion is that, you can create a new custom master page by copying the seatle.master page, verify the custom theme preview in the “Change the look” page,
    then add other customization one after one, keep verifying during the process. By doing this, it will be easier to find out the root cause.
    About using the F12 developer tools:
    https://msdn.microsoft.com/en-us/library/ie/bg182326%28v=vs.85%29?f=255&MSPPError=-2147217396
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • JFrame singelton problem - creates new frames

    Hello,
    I'm trying to program a card game where the main window is a singelton JFrame which consists of several cards (custom-created abstract sublass of JLabel) and a placeholder for a bigger icon. When the user hovers their mouse over any card it should set the icon of the bigger icon in the frame, and when the mouse exits it should revert back to the standard icon. Any of its subclasses call the abstract method in the card class first before they move on to their own implementation. My problem is, that every time I do this, instead of setting the icon, it just creates hundreds of new frames. I presume this has something to do with the frame being a singelton? Any help would be greatly appreciated.
    The GUI singelton part:
    private static GUI instance;
    public static GUI getInstance()
         if (instance != null)
              return instance;
         else return new GUI();
    }The Card class:
    public abstract class Card extends JLabel implements MouseListener */
         public ImageIcon icon, fullicon;
          * When the mouse hovers over the card, put the full icon into the top-right
          * spot of the GUI.
         public void mouseEntered(MouseEvent e)
              if (e.getSource() == this)
                   GUI.getInstance().bigicon.setIcon(fullicon);
          * When the mouse has left the card, put the regular card backside icon into the
          * top-right spot of the GUI.
         public void mouseExited(MouseEvent e)
              if (e.getSource() == this)
                   GUI.getInstance().bigicon.setIcon(GameConstants.BACK_ICON);
         }Example of a subclass:
    public SubCard()
         addMouseListener(this);
    * When the mouse exits the card, put the regular card backside icon into the
    * top-right spot of the GUI and remove all Damage Counters and Energy Card icons.
    * @Override mouseExited in Card
    public void mouseExited(MouseEvent e)
         super.mouseExited(e);
         GUI.getInstance().energyPanel.removeAll();
         for (int i=0; i<14; i++) {
              GUI.getInstance().energyPanel.add(new JLabel(new ImageIcon("icons/blank.gif")));
    }Edited by: pg-robban on Apr 12, 2009 11:31 AM
    Edited by: pg-robban on Apr 12, 2009 11:35 AM

    Just so you know, the general way to implement a singleton is like this.
    private static GUI instance;
    public static GUI getInstance()
        if (instance == null)
            instance = new GUI();
        return instance;
    }

  • JTextPane StyledDocument insertString multi Icon problem (BUG?)

    Hi,
    Now I am trying to insert some icons to the StyledDocument of JTextPane.
    I found a problem that if I want to insert the same Icon (actually the same style which contains this icon) into the StyledDocument for more than one time, only the first insert operation works.
    But if I insert a whitespace (or other non-zero length text) between the twe icon, it can works. I don't know it's my mis-using of this StyledDocument or it's a bug of JTextPane and StyledDocument?
    Thanks!
    My sample code below: To Run this code, you need to add a "icon" named "t1.jpg" in your project directory ^_^
    import java.awt.BorderLayout;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    import javax.swing.text.Style;
    import javax.swing.text.StyleConstants;
    import javax.swing.text.StyleContext;
    import javax.swing.text.StyledDocument;
    public class JTextPaneInsertIcons
         public static void main(String[] args) throws Exception
              JTextPane pane = new JTextPane();
              ImageIcon icon = new ImageIcon("t1.jpg");
              StyledDocument styledDocument = pane.getStyledDocument();
              Style iconStyle = styledDocument.addStyle("icon", null);
              StyleConstants.setIcon(iconStyle, icon);
              styledDocument.insertString(styledDocument.getLength(), " ", iconStyle);
              styledDocument.insertString(styledDocument.getLength(), " ", iconStyle);
              styledDocument.insertString(styledDocument.getLength(), "\n", StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE));
              styledDocument.insertString(styledDocument.getLength(), " ", iconStyle);
              styledDocument.insertString(styledDocument.getLength(), " ", StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE));
              styledDocument.insertString(styledDocument.getLength(), " ", iconStyle);
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(pane, BorderLayout.CENTER);
              frame.setSize(360, 180);
              frame.setVisible(true);
    }

    OK, OK, I got it.
    Thank you so much!
    It seems I need to solve this problem ugly like this:
    import java.awt.BorderLayout;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    import javax.swing.text.AttributeSet;
    import javax.swing.text.Element;
    import javax.swing.text.Style;
    import javax.swing.text.StyleConstants;
    import javax.swing.text.StyleContext;
    import javax.swing.text.StyledDocument;
    public class JTextPaneInsertIcons
         static StyledDocument styledDocument;
         public static void main(String[] args) throws Exception
              JTextPane pane = new JTextPane();
              ImageIcon icon = new ImageIcon("1.jpg");
              styledDocument = pane.getStyledDocument();
              Style iconStyle = styledDocument.addStyle("icon", null);
              StyleConstants.setIcon(iconStyle, icon);
              insertOne(iconStyle);
              insertOne(iconStyle);
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.getContentPane().add(pane, BorderLayout.CENTER);
              frame.setSize(600, 400);
              frame.setVisible(true);
         private static void insertOne(Style style) throws Exception
              if (style.getAttribute(StyleConstants.IconAttribute) != null)
                   if (styledDocument.getLength() > 0)
                        Element e = styledDocument.getCharacterElement(styledDocument.getLength() - 1);
                        AttributeSet attributeSet = e.getAttributes();
                        if (style.getAttribute(StyleConstants.IconAttribute) == attributeSet
                                  .getAttribute(StyleConstants.IconAttribute))
                             styledDocument.insertString(styledDocument.getLength(), " ", StyleContext
                                       .getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE));
              styledDocument.insertString(styledDocument.getLength(), " ", style);
    }

  • Crystal Reports Viewer - pdf, prompts, icons problem

    Hi all,
    I am a new in BO.
    I have some answer about Crystal Reports Viewer (not about setup.exe but about CRV application that I uploaded on Tomcat)
    1) The old version (11.5) works good, only Export to PDF functionality is wrong. There are in the pdf file wrong display of specific czech characters (charset)
    2) A new version, Crystal Reports Viewer 2008, show the same pdf mistake. I have J2SE Runtime Environment 5.0 Update 4 and Apache Tomcat 5.5.9.
    I upload application on Tomcat, configuration (web.xml, crconfig.xml and context.xml) is the same with version 11.5.
    Crystal Reports Viewer 2008 displayed reports, but the problem with PDF is present. The second problem is the look of CRV. First one, the icons (for export, print...all icons) are not displayd. I can copy old jar files into java (in application folder C:\WebReports\WEB-INF\lib), but then CRV looks like old version.
    And CRV 2008 doesn't display listbox in dynamic prompt on crystal report. What shall I set to displaying prompts in CRV 2008 (on CRV or on report in Crystal 2008)?
    Have you some idea? What and how can I set and configure application and where?
    Veronika

    Hi,
    To confirm, are you talking about "Crystal Reports Viewer 2008" http://www.sap.com/solutions/sapbusinessobjects/sme/reporting/viewer/index.epx
    I suggest sending in the report, in the viewer, select "Help" - "General Feedback" and then pick the option to attach the report.  In a couple of months there will be a refresh version of this view which will have Czech language support so it would be good if we could test out your PDF issue.
    As for showing parameters in the prompt panel in Crystal Reports Viewer 2008, since the viewer cannot refresh the data, make sure the parameter does not used in the record selection formula but only in the saved data selection formula.

  • Ios 7 icon problems still persist in air 3.9.0.1030

    In the release notes of air 3.9.0.1030 sdk it says:
    Notable bug fixes:
    [3622405] [AIR] [iOS7] - iOS7 requires 5 new icon sizes: 76px, 120px, 152px, 40px, 80px
    But i cant still select those icon sizes when publishing? is still being any problem?

    You can edit the xml then compile with command line. But I am still having a few tweaking issues but it should work this way.  But yes I hope we get a new build soon.....

  • Purchase game icon problem

    I purchased game icon, it says some network problem, but money been charged from my bank account

    Hey there Nyglen,
    It sounds like you have been charged for an in app purchase, but did not receive the item. I would reach out to our iTunes store support directly with this article named:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    http://support.apple.com/kb/ht1933
    To report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase, follow these steps:
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Thank you for using Apple Support Communities!
    All the best,
    Sterling

  • Icon problem in photoshop cs4

    when I place a tool icon  such as the move or hand over a picture it shows up three times exp: ( ### )
    how can I correct this problem?  to show only one exp: ( # )  using Photoshop  cs4

    It has to do with your text size.  This should help.
    Solution: Change the Windows text size to 149% or 151%.
    To change the text size:
    Choose Start > Control Panel > Appearance and Personalization > Display.
    Choose Set custom text size (DPI) in the menu on the left panel.
    Type in 149 or 151 into the Scale to this percentage of normal size field.
    Press enter and click OK.
    Choose to log off and then log on to make the change.

  • Firefox icons problem.

    I create and run my application in Forms 10.1.2.
    Running it using MSIE it works fine, using Firefox I've a problem with "greyed" menu icons.
    When I run it all disabled icons in my menubar are crunched.
    I prefer firefox because it's, by far, faster.
    Is it a known problem ?
    Is there any workaround ?
    Tks
    Tullio

    I peeked inside frmmain.jar and found the following, which appear to be the SmartBar icons:
         oracle/forms/icons/canqry.gif
         oracle/forms/icons/copy.gif
         oracle/forms/icons/cut.gif
         oracle/forms/icons/delrec.gif
         oracle/forms/icons/ellipsis.gif
         oracle/forms/icons/entqry.gif
         oracle/forms/icons/exeqry.gif
         oracle/forms/icons/exit.gif
         oracle/forms/icons/frame.gif
         oracle/forms/icons/help.gif
         oracle/forms/icons/insrec.gif
         oracle/forms/icons/lockrec.gif
         oracle/forms/icons/nxtblk.gif
         oracle/forms/icons/nxtrec.gif
         oracle/forms/icons/paste.gif
         oracle/forms/icons/print.gif
         oracle/forms/icons/prvblk.gif
         oracle/forms/icons/prvrec.gif
         oracle/forms/icons/pset.gif
         oracle/forms/icons/save.gifI suggest that you create a simple test menu bar that uses Oracle's icons, like the ones listed above. (They can be specified using short names, like canqry,copy,cut,delrec,ellipsis, etc.). Be sure to disable some of the menu items, since you mention that disabled items exhibit the problem you are having.
    If this menu bar displays correctly, I would conclude that the format of your images is somehow confusing Oracle. A quick thing to try would be to extract one of your images, open and resave it using a graphics program (e.g. Microsoft Photo Editor, Adobe Photoshop or PhotoDeluxe, etc.), rejarring and retesting. A more thorough approach would be to compare the properties of Oracle's images with those of your own (most graphics programs allow you to view file/image properties.)
    Hope this helps,
    Eric Adamson
    Lansing, Michigan

  • JFrame applications problem

    Hi, i'm just starting out writing swing applications and i'm having a few problems.
    Don't bother answering this if you think i'm too stupid because i don't want to waste your time.
    Whenever i write a swing application, it compiles but when i try to run it i get: <b>Exception in thread "main" java.lang.NoSuchMethodError: main</b>
    Heres my code:
    <code>
    import java.awt.*;
    import javax.swing.*;
    public class swingframe extends JFrame
         private JButton but;
         public swingframe()
                   Container c=getContentPane();
                   c.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
                   c.setBackground(Color.black);
                   but = new JButton("Wyld Stallyns Rule!!!");
                   but.setBackground(Color.green);
                   c.add(but);
    </code>
    Sorry again if i'm wasting your time.
    <b>Thanks</b>

    import java.awt.*;
    import javax.swing.*;
    public class SwingFrame extends JFrame{
       private JButton but;
       public SwingFrame(){
          Container c=getContentPane();
          c.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
          c.setBackground(Color.black);
          but = new JButton("Wyld Stallyns Rule!!!");
          but.setBackground(Color.green);
          c.add(but);
          this.setSize(200, 200);
          this.setDefaultCloseOperation( EXIT_ON_CLOSE );
       public static void main(String []args){
          new SwingFrame().show();
    }

  • JFrame decorations problem

    Greetings:
    I've found searching at the net, that it is suggested "that the L&F (rather than the system) decorate all windows. This must be invoked before creating the JFrame. Native look and feels will ignore this hint". The command that does this is the static JFrame.setDefaultLookAndFeelDecorated(true); .
    If I install Metal L&F as default, and then go to Full Screen and change the L&F, it partially WORKS (the Metal L&Fdecorations are set like in an InternalFrame); but if I set the System L&F as default and change the L&F, the new L&F does not recive its propper decorations but rather the system ones.
    Could anyone help me in this issue?
    Thanks a lot in advanced.
    Javier
    // java scope
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import com.sun.java.swing.plaf.motif.*;
    public abstract class LandFTest {
       public static void main(String[] args) {
          try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } //UIManager.getCrossPlatformLookAndFeelClassName()
          catch (Exception e) { }
          SwingUtilities.invokeLater(new Runnable() {
             public void run() { JFrame.setDefaultLookAndFeelDecorated(true);
                                 MainWin myWindow = new MainWin(" Look & Feel Test");
                                 myWindow.pack();
                                 myWindow.setVisible(true); }
    class MainWin extends JFrame {
          public Box mainLayout = new MainComponent(this);
             public JScrollPane mainLayoutScrollPane = new JScrollPane(mainLayout);
          public Boolean FullScrnOn=false;
       public MainWin (String mainWin_title) {
          Container framePanel = this.getContentPane();
          this.setTitle(mainWin_title);
          this.setLocationRelativeTo(null);
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          framePanel.add(mainLayoutScrollPane,BorderLayout.CENTER);
    class MainComponent extends Box {
          Box controls_Box = Box.createHorizontalBox();
          Box lfControl_Box = Box.createVerticalBox();
          JRadioButton landfRadioButton1 = new JRadioButton(" Metal skin (Java)"),
                       landfRadioButton2 = new JRadioButton(" System skin",true),
                       landfRadioButton3 = new JRadioButton(" Motif skin");
          ButtonGroup lanfFButtonGroup = new ButtonGroup();
          JButton fullScrnButton = new JButton("Full Screen On");
    public MainComponent(MainWin refFrame){
          super(BoxLayout.Y_AXIS);
          this.initMainCompopent(refFrame);
          this.setMainComponent();
       public void initMainCompopent (MainWin refFrame) {
           LookAndFeel_ActionListener landFListener = new LookAndFeel_ActionListener(lanfFButtonGroup, refFrame);
           FullScreen_ActionListener fullSCrnListener = new FullScreen_ActionListener(refFrame);
          lfControl_Box.setBorder(BorderFactory.createTitledBorder(" Look & Feel Control "));
          landfRadioButton1.setActionCommand("Java");
             landfRadioButton1.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton1);
          landfRadioButton2.setActionCommand("System");
             landfRadioButton2.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton2);
          landfRadioButton3.setActionCommand("Motif");
             landfRadioButton3.addActionListener(landFListener);
             lanfFButtonGroup.add(landfRadioButton3);
          fullScrnButton.addActionListener(fullSCrnListener);
          fullScrnButton.setAlignmentX(Component.CENTER_ALIGNMENT);
       public void setMainComponent () {
          controls_Box.add(Box.createHorizontalGlue());
          controls_Box.add(lfControl_Box);
             lfControl_Box.add(landfRadioButton1);
             lfControl_Box.add(landfRadioButton2);
             lfControl_Box.add(landfRadioButton3);
          controls_Box.add(Box.createHorizontalGlue());
          this.add(Box.createVerticalGlue());
          this.add(controls_Box);
          this.add(Box.createVerticalGlue());
          this.add(fullScrnButton);
          this.add(Box.createVerticalGlue());
    class LookAndFeel_ActionListener implements ActionListener {
          private ButtonGroup eventButtonGroup;
          private MainWin eventFrame;
       public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
          this.eventButtonGroup = buttonGroup;
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
          String command = eventButtonGroup.getSelection().getActionCommand();
          GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          eventFrame.dispose();
          if (command.equals("System")) {
            try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
            catch (Exception e) { }
          else { if (command.equals("Java")) {
                   try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());}
                   catch (Exception e) { }
                 else { if (command.equals("Motif")) {
                          try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
                          catch (Exception e) { }
                        else { }
          SwingUtilities.updateComponentTreeUI(eventFrame);
          if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
                                      finally {  }
          } else { JFrame.setDefaultLookAndFeelDecorated(true); }
          eventFrame.setVisible(true);
          //eventFrame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
    class FullScreen_ActionListener implements ActionListener {
          private MainWin eventFrame;
       public FullScreen_ActionListener (MainWin eventFrame) {
          this.eventFrame = eventFrame;
       public void actionPerformed(ActionEvent event) {
             MainComponent mainFrameLayout = (MainComponent)eventFrame.mainLayout;
             GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
          if (!eventFrame.FullScrnOn){
             if (scrnDevice.isFullScreenSupported()) {
                // Enter full-screen mode with an undecorated JFrame
                eventFrame.dispose();
                eventFrame.setUndecorated(true);
                eventFrame.setResizable(false);
                mainFrameLayout.fullScrnButton.setText("Full Screen Off");
                eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                try {scrnDevice.setFullScreenWindow(eventFrame); }
                finally {  }
             } else { JOptionPane.showMessageDialog(eventFrame, "Full Screen mode is not allowed \nby the system in this moment.",
                                                                " Full Screen Info", JOptionPane.INFORMATION_MESSAGE); }
          else { // Return to Windowed mode mode with JFrame decorations
                  eventFrame.dispose();
                  eventFrame.setUndecorated(false);
                  eventFrame.setResizable(true);
                  mainFrameLayout.fullScrnButton.setText("Full Screen On");
                  eventFrame.FullScrnOn=!eventFrame.FullScrnOn;
                  try { scrnDevice.setFullScreenWindow(null); }
                  finally { }
          eventFrame.setVisible(true);
    }

    Greetings:
    Thanks a lot for your kind answer:
    After reading your reply, I've done some studies directly in the API in how does the L&F's are managed. Of what I've understood (please correct me if I'm wrong), the things are as follow:
    i) System and Motif Look and Feel's does NOT support decorations, so that's why you should let the JVM do the decoration work (that is, use myFrame.setUndecorated(false); ).
    In this case, it does not matter if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame: it won't show decorations if you don't use the command mentioned.
    ii) Metal (Java) Look and Feel DOES support decorations; that's why, if you use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of the frame, you'll see it's own decorations. In this case, you should use myFrame.setUndecorated(true); so the L&F does all the decorating work, avoiding the weird sitiuation of showing double decorating settings (L&F's and native system's).
    iii) So, the real problem here would be if you want to have, as a user choice, that the System/Motif L&F's will be available together with the Java's (Metal). I've made the next variation to my code, so that this will be possible:
    class LookAndFeel_ActionListener implements ActionListener {
    private ButtonGroup eventButtonGroup;
    private MainWin eventFrame;
    public LookAndFeel_ActionListener (ButtonGroup buttonGroup, MainWin eventFrame) {
    this.eventButtonGroup = buttonGroup;
    this.eventFrame = eventFrame;
    public void actionPerformed(ActionEvent event) {
    String command = eventButtonGroup.getSelection().getActionCommand();
    GraphicsDevice scrnDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    eventFrame.dispose();
    if (command.equals("System")) {
    try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    catch (Exception e) { }
    else { if (command.equals("Java")) {
    try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(true); // make sure the L&F controls decorations as it actually has one's.
    else { if (command.equals("Motif")) {
    try { UIManager.setLookAndFeel(new MotifLookAndFeel()); }
    catch (Exception e) { }
    eventFrame.setUndecorated(false); // make sure the native system controls decorations as this L&F doesnt's manage one's.
    else { }
    SwingUtilities.updateComponentTreeUI(eventFrame);
    if (eventFrame.FullScrnOn){ try {scrnDevice.setFullScreenWindow(eventFrame); }
    finally { }
    } else { }
    eventFrame.setVisible(true);
    }iv) The issue here is that, as I needed to use myFrame.dispose() (the JVM says that it is not possible to use setUndecorated(false); in a displayable frame), I recieve and error:
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Buffers have not been created
    at sun.awt.windows.WComponentPeer.getBackBuffer(WComponentPeer.java:846)
    at java.awt.Component$FlipBufferStrategy.getBackBuffer(Component.java:3815)
    at java.awt.Component$FlipBufferStrategy.updateInternalBuffers(Component.java:3800)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3915)
    at java.awt.Component$FlipBufferStrategy.revalidate(Component.java:3897)
    at java.awt.Component$FlipBufferStrategy.getDrawGraphics(Component.java:3889)
    at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:508)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:264)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
    at javax.swing.JComponent.paint(JComponent.java:1015)
    and, yet, the Metal (Java's) L&F keeps without decorations. Is it there a way to solve this without having to create a new instance of the frame and use JFrame.setDefaultLookAndFeelDecorated(true); before the creation of such new instance of the frame for the Metal's (Java) L&F?
    Thanks again for al lthe help: this was, definetelly, something not obvious to figure out (or to find a hint on the net).
    Regards,

  • JFrame minimizing problem

    I am writing an application where i have many JFrames on the screen at the same time. The problem is that when i click on a menu item in one of the screens the rest of them get minimized. Is there any way of preventing this without using JInternalFrames.

    can you please supply source code, I may not be able to help but other's can.

  • JFrame Dispose Problem

    Hello everyone,
    This is probably a really easily answerable question and I think the reason is that I have the problem is because I'm getting a stack overflow but I am not sure how to solve it.
    So, my program is a simple login and logout program
    A login JFrame creates a new Main JFrame when log in is pressed, then login is disposed.
    When a user logs out of the main frame, a new Login Frame is created and the Main Frame disposed
    The problem is that when the user logs in again, the main frame is created but the login frame remains even though dispose is called,
    why is this?
    Any help at all is greatly appreciated!
    Cheers

    why is this?You have a bug in your code.
    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.

Maybe you are looking for

  • What is Time Machine error code -6584, What is Time Machine error code -6584, What is Time Machine error code -6584

    My mac book pro crashed badly after latest Apple update. I have had to reinstall the the operating system to get my mac book pro working again. Thanks to Apple support team who where helpful and actually got my mac able to load up. I am now trying to

  • Set headers with jsp

    hi, i try to make a download page with jsp. here is my code: <%@ page import="java.io.*,javax.servlet.*,java.util.* "%> <%           String filename = "super.zip"; response.setContentType("application/octet-stream"); response.setHeader("Content-Dispo

  • What is the "other" category that occupies storage in iPod touch

    What is in the "other" category that occupies storage in iPod touch?

  • Nokia N80 crashing!

    My nokia N80 keeps crashing when i send a text message, my network is vodafone if that makes any difference. if any one knows whats going on or knows how i can resolve this issue please let me know. Dan .:: DAN ::.

  • Network Message

    I keep getting a message similar to the one below in my e-mail inbox. How can I get it to go away? This message is used to carry data between the BlackBerry handheld and an associated server. Please do not delete, move or respond to this message - it