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