JFrame which does not allow resizing (maximizing, minimizng)

I want to develop a login frame which does not allow resizing (maximizing, minimizing as this does not make sense) and with 2 fields, JTextField and JPasswordField.
The frame is developed but has the usual resizing handles.
How to do?
Many tks for any information.
John Pashley

Don't use a JFrame. Also, don't expect code like this again; I did it for fun.
It requires your modification.
* Title:        Login Screen<p>
* Description:  Login Screen<p>
* Class:        Login ScreenLoginScreen<p>
* Copyright:    who cares<p>
* Company:      who cares<p>
* @author who cares
* @version who cares
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.util.Vector;
import java.io.File;
import javax.swing.*;
public class LoginScreen extends JDialog implements ActionListener, FocusListener
   private JTextField      name;
   private JPasswordField  password;
   private JButton         loginButton;
   private JButton         cancelButton;
   private JDialog         thisDialog = this;
   private ImageIcon       splashImage;
   private String          appTitle;
   private int             logCounter;
   public LoginScreen()
      super();
      this.toFront();
      setTitle("Login");
      addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent e)
                System.exit(0);
      getContentPane().setLayout(new BorderLayout());
      splashImage = new ImageIcon( getClass().getResource("images" + File.separator + "image.jpg")) );
      getContentPane().add(new JLabel(splashImage), "North");
      getContentPane().add(makeLoginPanel(), "Center");
      getContentPane().add(makeButtonPanel(), "South");
      pack();
      setResizable(false);
      setLocationRelativeTo(null);
      setVisible(true);
    * make login panel
   private JPanel makeLoginPanel()
      JPanel loginPanel = new JPanel();
      JLabel label;
      loginPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 0, 20));
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      loginPanel.setLayout(gbl);
      gbc.weightx = 1.0;
      gbc.fill = GridBagConstraints.HORIZONTAL;
      gbc.insets = new Insets(0, 5, 10, 5);
      gbc.gridx = 0;
      gbc.gridy = 0;
      label = new JLabel("Login Name:", SwingConstants.LEFT);
      gbl.setConstraints(label, gbc);
      loginPanel.add(label);
      gbc.gridx = 1;
      name = new JTextField("insider", 10);
      name.addFocusListener(this);
      gbl.setConstraints(name, gbc);
      loginPanel.add(name);
      gbc.gridx = 0;
      gbc.gridy = 1;
      label = new JLabel("Password:", SwingConstants.LEFT);
      gbl.setConstraints(label, gbc);
      loginPanel.add(label);
      gbc.gridx = 1;
      password = new JPasswordField("insider",10);
      password.addFocusListener(this);
      gbl.setConstraints(password, gbc);
      loginPanel.add(password);
      return loginPanel;
    * make button panel
   private JPanel makeButtonPanel()
      JPanel buttonPanel = new JPanel();
      buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
      //make LogIn button
      loginButton = new JButton("Login");
      loginButton.setActionCommand("Login");
      buttonPanel.add(loginButton);
      rootPane.setDefaultButton(loginButton);
      loginButton.addActionListener(this);
      this.getRootPane().setDefaultButton(loginButton);
      //make Cancel button
      cancelButton = new JButton("Cancel");
      cancelButton.setActionCommand("Cancel");
      buttonPanel.add(cancelButton);
      cancelButton.addActionListener(this);
      this.addKeyListener(new KeyAdapter()
         public void keyReleased(KeyEvent e)
            if(e.getKeyCode() == KeyEvent.VK_ESCAPE)
               cancelButton.doClick();
         return buttonPanel;
    * Action handler for login and cancel buttons
   public void actionPerformed(ActionEvent e)
      JButton btn = (JButton) e.getSource();
      if (btn.getActionCommand().equals("Login"))
         // Because login() process happens before swing process (above),
         // force it to happen "later"
         SwingUtilities.invokeLater(new Runnable()
            public void run()
               login(); //create this method, okay?!
      else if (btn.getActionCommand().equals("Cancel"))
         System.exit(0);
    * Focus gained handler for username and password buttons
   public void focusGained(FocusEvent e)
      JTextField tf = (JTextField) e.getSource();
      tf.selectAll();
    * Focus lost handler for username and password buttons
   public void focusLost(FocusEvent e) {}
   private void showErrorMessage(String message, String header)
      JOptionPane.showMessageDialog(getContentPane(),
                                    message, header,
                                    JOptionPane.ERROR_MESSAGE);
    * This method controls the cursor for login window. If isWait is set to
    * true, dialog's cursor is set to Cursor.WAIT_CURSOR. If isWait is set
    * to false, the cursor is set ta Deafult.
    * While the window is in WAIT mode, this method will also disable Login
    * and Cancel buttons to ensure the user does not accidently request
    * a cancel while loging in or launching a second login.
   private void setWaitCursor(boolean isWait)
      /* In order to disable login and cancel buttons while logging in to the
         application, this method will temporarely change action commands and
         reset them when login process failed to give user another chance.
         Note: Disabling the buttons by calling setEnabled(false) did not work
         since login() method is called from an action event handler and the
         process will not be released to AWT until login method is complete.
      if (isWait)
         this.getGlassPane().setCursor(new Cursor(Cursor.WAIT_CURSOR));
         this.getGlassPane().setVisible(true);
         loginButton.setActionCommand("none");
         cancelButton.setActionCommand("none");
      else
         this.getGlassPane().setCursor(Cursor.getDefaultCursor());
         this.getGlassPane().setVisible(false);
         loginButton.setActionCommand("Login");
         cancelButton.setActionCommand("Cancel");
} //end loginscreen

Similar Messages

  • HT1766 I have a pop up about  Photo stream which does not allow me to click ignore or settings - nothing happens when pressed........I cannot click on anything - the screen seems to have frozen and having tried to turn off I cannot slide to turn off. Plea

    I have a pop up about  Photo stream which does not allow me to click ignore or settings - nothing happens when pressed........I cannot click on anything - the screen seems to have frozen and having tried to turn off I cannot slide to turn off. Please can e frozen and having tried to turn off I cannot slide to turn off. Please can you help

    Reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • Have Yahoo Mail Plus, which does not allow ads. When on my work computer and log into my Yahoo account, ads do appear?? This does not happen on Explorer. Help

    Have a Yahoo Mail Plus account, which does not allow for ads. It works fine on Explorer, but when used on Firefox the same ads always appear both at the top and left margins "Dr. Oz New Weight Loss Secret". Yahoo says it is a Firefox issue. Please help.

    another thing you can try is to [[Reset Firefox – easily fix most problems|reset firefox]].
    in case there are still adverts shown in places where they aren't supposed to be afterwards, it sounds like an issue with malware on the system. please run a full scan of your pc with the security software already in place and different tools like the [http://www.malwarebytes.org/products/malwarebytes_free free version of malwarebytes], [http://www.microsoft.com/security/scanner/default.aspx microsoft safety scanner] or [http://www.kaspersky.com/security-scan kaspersky security scan].
    [[Troubleshoot Firefox issues caused by malware]]

  • I have an old account with purchased songs in it,however I have a new account now which does not allow me to listen to this purchased music.I have tried changing the password but to no avail.Please help

    The problem is I have an old account from an old I-pod which is now broken.Well the I-pod has been binned.I have a new i-pod and have a new user name.I have tried to access the songs i purchased yeateryear on my old device but and this  is a but .....The new account will not allow me to access these older purchased songs. I cannot listen to them or burn them onto a cd.It throws up my old account user name in a window with a password request to access this material.I have changed my password several times however I still cannot access these purchased songs.

    iPods (that are not iPod touch) are not directly linked to any "account."  They are associated with your iTunes library.  The account in iTunes is your Apple ID, which is used to purchase and download content from the iTunes Store.  It lets the iTunes Store know who you are when you sign in.
    Songs that are currently sold by the iTunes Store do not use DRM (copy protection).  However, songs purchased during the earlier days of the iTunes Store do use DRM.  If you have such songs that were purchased using a previous Apple ID (not your current Apple ID), you need to authorize your computer for that previous Apple ID.
    Find one of the songs that does not play due to this problem.  Right-click on it in any iTunes list, and select Get Info.  On the song's Info window Summary tab, look for Apple ID.  That is the Apple ID used to purchase this song.
    From the iTunes menu bar, under Store, select Authorize This Computer.  In the dialog window that appears, enter that Apple ID used to make the old song purchases (plus password).  Do not enter your current Apple ID and password.  Click Authorize.
    The computer is now authorized for BOTH your old Apple ID and your current Apple ID.

  • Create PDF which does not allow to print

    My customer would like to use smartform HR_ESS_PAYSLIP_TO_PDF. The requirement is to convert the payslip to PDF, not allow to print the PDF.
    The <b>no print</b> information should be included in the document itself.
    I know this is generally possible because there a converters which have these option, e.g. http://www.abxzone.com/abx_reviews/paragon6/article_p3.html see "security ranging".
    How can I set this up using smartforms?
    Kind regards
    Marcus

    HI Paulo,
    Perhaps the Preview preference file is corrupted after the upgrade.
    Delete this file.
    com.apple.Preview.plist
    /Users/YourName/Library/Preferences. Drag that file to the Trash, empty the Trash and restart your Mac.
    See if that makes a difference.
    Also, check the manufacture web site for your printer and see if there are any updates available for your printer model for compatibility with 10.6. That could be part of the problem.
    Some users are having luck with reinstalling the software that originally came with their printers. If you do not have the disk, go to the web site and download the drivers for 10.5. They might work.
    Carolyn

  • FF 6.0 does not terminates itself, "plugin-container.exe" keeps running which does not allow termination of process

    After up-graduation to FF 6.0, FF fails to terminate when closed via X button or through Exit options in Menu. It was found that ''plugin-container.exe'' does not terminate causing failure to terminate ''firefox.exe''. ''plugin-container.exe'' runs as a sub-process to ''firefox.exe''

    After up-graduation to FF 6.0, FF fails to terminate when closed via X button or through Exit options in Menu. It was found that ''plugin-container.exe'' does not terminate causing failure to terminate ''firefox.exe''. ''plugin-container.exe'' runs as a sub-process to ''firefox.exe''

  • What can I do to fix Mail software, which does not allow me to move messages around, save "drafts", receive or send messages?

    My "Mail" software looks to have become corrupted, as I can't move messages around, save "drafts", receive or send messages.  The problem occurred after my Mac crashed and was re-started. Any ideas on what can I do to fix this? Any good suggestions appreciated!

    The Mail program is probably not what is corrupted. That would be extremely difficult because it is not written back to disk. The problem is likely in your user data.
    You could check that by logging into a different account (make one if you don't) and set up Mail in that account. If it works fine in that account then you have a problem in your user data.
    To reinstall Mail, you'll have to get out your Snow Leopard install DVD and check if it is part of the Optional Installs. If it is not, you could use a program called Pacifist to extract the Mail installer. You'd then have to install the 10.6.7 combo Update to bring Mail up to current version.
    What are the permissions on your Mail folder? Post output of this command you run in Terminal (just copy and paste):
    ls -ale ~/Library/Mail
    ls is List. -a tells it to show hidden files/folder. l tells it to make a list with details. e tells it to list Access Control List entries.

  • When making a new playlist, the screen layout has changed, the playlist header is now on the left instead of the right, this does not allow me to drag the songs onto the playlist, how do I reset?

    When Making a new play list, the play list was on the right of the screen and this allowed you to drag your music onto the playlist, my setup has changed to the left of the screen which does not allow you to drag your music across, how do I reset?

    In the top corner of iTunes is a small icon with a down arrow, click on that and choose 'show menu bar'. 
    Then on the view menu which now appears choose 'show sidebar'

  • I have 2 emai accounts which worked perfectly on iphone 4 but on iphone 5 my msn account wont let me reply to emails sent to that account, it leaves the message in my outbox saying recipient was rejected by the server because it does not allow relaying

    I have 2 email accounts which both worked perfectly well on my ipone 4 but since going over to iphone 5 my msn account will not allow me to reply to any emails. It places a message on my screen stating a copy has been placed in your Outbox. The recipient   @.com was rejected by the server because it does not allow relaying. Any ideas on how I can sort this. Would it be worth deleting my MSN account ant putting re-inputting the details again?

    Your email provider has blocked the standard mail port 25 for sending emails and is requiring a different port. This is to avoid mail relays that use mail clients to send spam. You need to find the port that is used by your provider for sending outgoing mail. Then change the settings in your email account on your phone to match the port. You will also have to provide some security credentials for the account.
    You can also try deleting the email account from your iphone, and the adding the email account back as this will many times set the correct port for sending emails.
    You could also do a Google search on the the settings for your device with your email provider. That will provide you with the proper settings.

  • When I use safari I keep getting a small coloured circular icon which in turn does not allow me to navigate at all.  the only way I can get rid of it is to shut down and reboot.  Can anyone help?

    When I use safari I keep getting a small coloured circular icon which in turn does not allow me to navigate at all.  the only way I can get rid of it is to shut down and reboot.  Can anyone help?

    Start here.

  • TS3212 When I try to download iTune, it shows Drive K which does not exist in my computer. It does not allow me to change to other Drive and terminate download stating ' out of disk capacity"

    Whne I download iTune, it shows that it will be downloaded to Drive K which does not exist in my computer. It does not allow me to change to other Drives has enough capacity. Then I click change bottom, attempting to change drive, it terminates the download.
    Do you have any solutions??

    Try "Invalid drive X:\" install errors. You should still be able to chose the drive for the download when downloading the installer with a web browser. The iTunes application is installed on the active system drive, usually drive C:.
    tt2

  • IOS 7 - Does not allow to resize picture

    IOS 7 - Does not allow to resize picture to its original size when setting the picture as a wallpaper.    Please test and verify software before release.  This seems like a pretty silly mistake.  Fix this wallpaper resize issue and release new OS.

    While you are waiting for the fix, have you tried this User Tip? It might work on your phone too:
    Fix for wallpaper scaling in iOS 7 on retina display iPads  https://discussions.apple.com/docs/DOC-6261

  • Imovie is limited to its import formats and does not allow for storing video in any rawformat.  Which means all videos will contain lossy compression applied to the video-.with no way to edit full format video.  Is this statement true?

    Imovie is limited to its import formats and does not allow for storing video in any rawformat.  Which means all videos will contain lossy compression applied to the video….with no way to edit full format video.  Is this statement true? Does iMovie support HD 1080p @ 60 fps?

    Iggy826 wrote:
    …   Is this statement true?
    yes and no!
    using the intended Import from Camera routines, iM converts automatically in its very own AppleIntermediateCodec. so, answer is yes.
    but …
    a) Apple claims , aic is non-lossy intermediate codec. working with proRes in FCPX taught me, there are even less non-lossy-ness codecs
    b) iM offers an Archive feature, which is basically a simple Finder/copy operation which 'clones' your SDcards content into some folder on your harddrive; e.g. you can later use these untouched  'raws' in another editor such as FCPX. so, answer is no.
    c) when you 'override' the import routines by manually re-wrapping mts into a mov container, iM handles the 'native' h264s ... so, answer is no.
    d) adding any effect, transition etc. reduces any interlaced source to 540p. (if you're working with 720p source, res is kept) … so, answer is yes. or, in 720p case, no.
    < Johnny Depp's voice >… savvy?
    Does iMovie support HD 1080p @ 60 fps?
    via Import from Camera? No.
    via re-wrapped mts>>mov? I was told yes, some say no.
    one thing to be kept in mind when talking about these 'issues':
    iM, this 12€, is meant as a CONSUMER toy tool.
    it supports AVCHD vers1 (=no 1080/60p, no >24Mbps, no 3D).
    fingers crossed, we'll see soon some iM/QT/FCPX update for support of AVCHD v2 ........
    the main consumer devices are within the specs, iM supports.
    using professional equipments makes usage of professional software (FCPX, AP) optional.
    sorry for lengthy answer.

  • Every time I try to send an email, I get an error message which says "The recipient was rejected by the server because it does not allow relaying" How can I fix this?

    My email is not working properly, I can receive emails but I cannot send them. Every time I try to send an email an error message appear saying "The recipient was rejected by the server because it does not allow relaying". There used to be no problem with my email it has only come up recently. Also, my Internet works fine. I have tryed restoring my iPad to factory settings but it still doesn't work. Does anyone know how to fix it?

    try to check the email id   of the guy you are trying to send the email to as i had the same problem i had written yahoo.com when it was yahoo.in 

  • Disk utility does not allow to restore Macintosh HD after I deleted a small size (1GB) partition

    Hi, when I tried to create a new 1GB partition (on my Mac mini 2011, using Mac OS X 10.7.3) and then to delete it I could not restore (increase) Macintosh HD size using Disk utility (diskutil list shows the same value for Macitosh HD (498,17GB) partition before and after I deleted a new created 1GB partition).
    Please help, how I can restore the original size of Macintosh HD when Disk utility does not allow to restore Macintosh HD after I deleted a small size (1GB) partition?
    Thank you.

    The bottom right corner dragging does not help in my case, because it shows that Macintosh HD partition size is maximal, but its real size did not change after I removed 1GB partition.
    Maybe any other idea can help me, for example some built-in tool like diskutil which allows to view and manage unused partitions in terminal?
    Thank you.

Maybe you are looking for

  • Serial number says invalid when I put it on a new computer MacBook pro

    I Purchased pse13 and installed it on my pc.  However I decided to purchase a Mac book pro and want to install pse13 on it as I will be selling my pc.  It keeps telling me the serial number is invalid.  Also how do I make a backup copy of the softwar

  • Importing from an iPhoto library only half appear in the application but half are left in the library,how to move on?

    when I import from an upgraded iPhoto library half the photos appear in the application but half are left in the library. How do I get my iPhoto to show all the photos?

  • E-commerce for ERP

    Where can I find the documentation for installation of E-Commerece for ERP?  We just upgraded to ECC 6.0 and was looking for a solution to move away from the old "Online Store" & ITS.  We currently use this old way for B2B & B2C transactions. I heard

  • JTabbedPane focus

    I have a JTabbedPane with several tabs on it. When I insert a new tab to the pane is there a way so that it shows that tab instead of the tab that was showing before?

  • Error when doing initialization of siebel tools

    Hi Experts, I successfully initialized the dedicated client but when after installing the tool I tried to initialize the local DB for the same user I am having the following issue: SQLError     Statement     0     0     2011-05-11 22:31:48     SQL St