Ask Your Question

unable to full screen swing form on fedora 20

asked 2014-07-16 05:08:25 -0500

pradeep24 gravatar image

updated 2014-07-20 00:23:24 -0500

abadrinath gravatar image


I am java developer and want to make swing form full screen even on taskbar on linux machine. But after trying so hard unable to achieve it. I am using fedora as operationg system. Below i am giving you my swing code. but whenever i run this file form comes up on the screen and waits for a second and it goes in background. I unable to understand why this is happening. so please help me to solve this problem.

i am using linux OS Fedora 64 bit.

import java.awt.Color; import java.awt.Font; import java.awt.GraphicsEnvironment; import java.awt.image.BufferedImage; import; import;

import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException;

public class ThankYou {

JFrame f; 
JTextArea nameField;
JLabel lable;
String str;

public ThankYou() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
    String mystr=Readxml();
    f=new JFrame(); 

    nameField = new JTextArea(str);//value of str is Thank You 
    nameField.setForeground(new Color(6,42,120));
    nameField.setFont(new Font("Caladea", Font.BOLD, 60));

    BufferedImage image = File("imageTMB.jpg"));
    lable=new JLabel(new ImageIcon(image));
    lable.setLayout(null );


public String Readxml()

        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document doc = docBuilder.parse (new File("File.xml"));
        doc.getDocumentElement ().normalize ();
        NodeList listOfPersons = doc.getElementsByTagName("Format");

        Node FormatNode = listOfPersons.item(0);
        Element firstPersonElement = (Element)FormatNode;

        NodeList firstNameList = firstPersonElement.getElementsByTagName("ThankYou");
        Element firstNameElement = (Element)firstNameList.item(0);

        NodeList textFNList = firstNameElement.getChildNodes();

    catch(SAXParseException err){
         System.out.println ("** Parsing error" + ", line " 
                 + err.getLineNumber () + ", uri " + err.getSystemId ());
            System.out.println(" " + err.getMessage ());

            }catch (SAXException e) {
            Exception x = e.getException ();
            ((x == null) ? e : x).printStackTrace ();

            }catch (Throwable t) {
            t.printStackTrace ();

    return str;

public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
    new ThankYou();



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-07-19 01:00:21 -0500

abadrinath gravatar image

I am pretty sure this is a bug with your code, or otherwise, a bug with Java. I have tried your code, and it does not work. This is not exactly relevent to Fedora, so I suggest you take this code to Stack Exchange or Linux Questions. They could provide a much better answer than most of us here :).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-07-16 05:08:25 -0500

Seen: 208 times

Last updated: Jul 19 '14