Results 1 to 5 of 5
  1. #1
    Jktu is offline Member
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    0

    Default How to hide a window of application

    Tell me please how I can hide a window of application via frame.setVisible(false) at JBuilder then afresh his to display via frame.setVisible(true) on striking the buttons on keyboard
    Herewith all AWT-evens are at class Admin (parent), but
    daughterly class Admin frame = new Admin(); is at class Server where is method main

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Is that your main class invoke with a frame? Can you show your code here, what you have done so far.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default

    You can only capture keyboard input on a visible component in the focused window. If you want to hide your application and have a way of unhiding it, take a look at TrayIcon.

    db

  4. #4
    Jktu is offline Member
    Join Date
    Oct 2008
    Posts
    2
    Rep Power
    0

    Default

    class Admin:
    package server;

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    import com.borland.dx.sql.dataset.*;
    import java.sql.*;
    import javax.swing.tree.*;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import java.util.*;


    public class Admin extends JFrame {
    JPanel contentPane;
    JMenuBar jMenuBar1 = new JMenuBar();
    .... and miscellaneous
    Here is all buttons, containers and other

    And second class Server
    package server;

    import javax.swing.UIManager;
    import java.awt.*;

    public class Server {
    boolean packFrame = false;


    public Server() {
    Admin frame = new Admin();

    if (packFrame) {
    frame.pack();

    }
    else {
    frame.validate();
    }

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height) {
    frameSize.height = screenSize.height;
    }
    if (frameSize.width > screenSize.width) {
    frameSize.width = screenSize.width;
    }
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);

    }
    /**Main method*/
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAn dFeelClassName());
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    new Server();
    }
    }

    How I can to use frame at the class Admin or an event of keyboard input implements at the class Server

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. How to Hide cursor
    By priya in forum Java Software
    Replies: 1
    Last Post: 12-09-2010, 09:39 PM
  2. [SOLVED] how to hide jframes
    By yonghan in forum AWT / Swing
    Replies: 6
    Last Post: 08-10-2009, 04:08 AM
  3. Developing Window based application
    By hisouka in forum New To Java
    Replies: 7
    Last Post: 08-11-2008, 05:12 AM
  4. java : how to hide application icon from a task bar
    By yogeshagashe in forum Advanced Java
    Replies: 0
    Last Post: 03-12-2008, 01:05 PM
  5. To hide browser heading
    By priyanka_t in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-09-2008, 07:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •