Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: unable to full screen swing form on fedora

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default unable to full screen swing form on fedora

    Hi,

    I 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.

    -------------------------------------------------------------

    public class ThankYou {

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

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

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

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

    lable.add(nameField);
    f.add(lable);
    f.setResizable(false);
    f.setUndecorated(true);
    f.validate();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().setFullScreenWindow(f);
    f.setVisible(true);
    }

    public String Readxml()
    {
    try{

    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();
    strNode)textFNList.item(0)).getNodeValue().trim();



    }
    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();

    }

    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: unable to full screen swing form on fedora

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Please post your code correctly per the above link. It's difficult to read as it is currently posted.

    If you're following a tutorial or have a reference for the inspiration of the code above, please provide a link.

Similar Threads

  1. login form in 3 tire arch using swing with pojo
    By zayir in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 26th, 2014, 05:31 AM
  2. [SOLVED] Form in Swing
    By learn_java in forum AWT / Java Swing
    Replies: 2
    Last Post: November 6th, 2012, 09:03 AM
  3. Drawing in Full Screen
    By MizukiTHPS in forum AWT / Java Swing
    Replies: 7
    Last Post: March 27th, 2012, 11:48 AM
  4. Place form in center of screen
    By Blackbird in forum AWT / Java Swing
    Replies: 14
    Last Post: July 7th, 2011, 02:12 PM
  5. Java Swing :Back Button from one form to another form
    By srinivasan_253642 in forum AWT / Java Swing
    Replies: 1
    Last Post: December 26th, 2009, 09:51 AM