Stop the Frame from being able to be dragged

Hi all
I was hoping that someone could tell me how to stop the frame from being dragged
while a dialog is showing.
I am using this code to call the dialog.
When is is visible I can still click and drag the frame behind it.
I want to set it so you can not drag it until the dialog has be closed.
    public void runStartup() {
        Login dlg = new Login(this, "Login", true);
        Dimension dlgSize = dlg.getPreferredSize();
        Dimension frmSize = getSize();
        Point loc = getLocation();
        dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
                        (loc.y + 22));
        dlg.setModal(true);
        dlg.pack();
        dlg.show();
    }

here is the Login Class
package build0_0_1.dialogs;
import java.awt.BorderLayout;
import java.awt.Frame;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.*;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import build0_0_1.images.image_pics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusAdapter;
import build0_0_1.mysql.MYSQLDAO;
import build0_0_1.Command;
import javax.swing.*;
import java.sql.SQLException;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Login extends JDialog {
    ImageIcon back;
    MYSQLDAO mysqlDAO;
    Command command;
    JPanel panel1 = new JPanel();
    XYLayout xYLayout1 = new XYLayout();
    JLabel loginLabel = new JLabel();
    JLabel nameLabel = new JLabel();
    JLabel passwordLabel = new JLabel();
    JComboBox jComboBox1 = new JComboBox();
    JPasswordField passwordField = new JPasswordField();
    JButton loginButton = new JButton();
    JButton cancelButton = new JButton();
    JLabel backLabel = new JLabel();
    JLabel logoLabel = new JLabel();
    JComboBox locationComboBox = new JComboBox();
    JLabel locationLabel = new JLabel();
    public Login(Frame frame, String string, boolean _boolean) {
        super(frame, string, _boolean);
        try {
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            jbInit();
            pack();
        } catch (Exception exception) {
            exception.printStackTrace();
    public Login() {
        this(new Frame(), "Login", false);
    private void jbInit() throws Exception {
        this.setResizable(false);
        this.setUndecorated(true);
        this.setSize(new Dimension(450, 220));
        back = new ImageIcon(image_pics.LOGIN_BACK);
        logoLabel.setIcon(new ImageIcon(image_pics.SMALL_LOGO));
        panel1.setLayout(xYLayout1);
        panel1.setMinimumSize(new Dimension(450, 220));
        panel1.setPreferredSize(new Dimension(450, 220));
        loginLabel.setText("Login");
        nameLabel.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        nameLabel.setText("User Name");
        passwordLabel.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        passwordLabel.setText("Password");
        backLabel.setIcon(back);
        passwordField.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        passwordField.setText("Enter Password");
        passwordField.addFocusListener(new
                                       Login_passwordField_focusAdapter(this));
        loginButton.setBackground(new Color(231, 231, 231));
        loginButton.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        loginButton.setText("Login");
        loginButton.addActionListener(new Login_loginButton_actionAdapter(this));
        cancelButton.setBackground(new Color(231, 231, 231));
        cancelButton.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        cancelButton.setActionCommand("cancelButton");
        cancelButton.setSelected(true);
        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new Login_cancelButton_actionAdapter(this));
        jComboBox1.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        jComboBox1.setEditable(true);
        logoLabel.setBorder(null);
        logoLabel.setHorizontalAlignment(SwingConstants.CENTER);
        logoLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        logoLabel.setText("");
        locationLabel.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN, 11));
        locationLabel.setText("Location");
        locationComboBox.setFont(new java.awt.Font("Lucida Grande", Font.PLAIN,
                11));
        panel1.add(cancelButton, new XYConstraints(337, 170, -1, -1));
        panel1.add(loginButton, new XYConstraints(245, 170, -1, -1));
        panel1.add(loginLabel, new XYConstraints(208, 21, -1, -1));
        panel1.add(logoLabel, new XYConstraints(21, 20, 57, 54));
        panel1.add(passwordLabel, new XYConstraints(99, 141, -1, -1));
        panel1.add(locationLabel, new XYConstraints(104, 72, -1, -1));
        panel1.add(nameLabel, new XYConstraints(90, 106, -1, -1));
        panel1.add(passwordField, new XYConstraints(185, 138, 219, -1));
        panel1.add(jComboBox1, new XYConstraints(183, 103, 219, -1));
        panel1.add(locationComboBox, new XYConstraints(183, 67, 219, -1));
        panel1.add(backLabel, new XYConstraints(0, 0, 451, 223));
        getContentPane().add(panel1);
        panel1.grabFocus();
     * Exit action performed.
     * @param actionEvent ActionEvent
    public void cancelButton_actionPerformed(ActionEvent actionEvent) {
        System.exit(0);
     * Login to MySQL Server. Using User ame and Password
     * This pass into MYSQLDAO user Name and Password
     * @param actionEvent ActionEvent
    //This pass into MYSQLDAO user Name and Password
    public void loginButton_actionPerformed(ActionEvent actionEvent) {
        String pass = new String(passwordField.getPassword());
        if (!pass.equals("Enter Password")) {
            System.out.println("This the username   " +
                               (String) jComboBox1.getSelectedItem() + "\n" +
                               "Password is     " + pass);
            try {
                mysqlDAO = new MYSQLDAO();
                mysqlDAO.setUserName((String) jComboBox1.getSelectedItem().
                                     toString().
                                     trim());
                mysqlDAO.setPassword(new String(passwordField.getPassword()));
            } catch (SQLException ex) {
                // handle the error
                System.out.println("SQLException: " + ex.getMessage());
                System.out.println("SQLState: " + ex.getSQLState());
                System.out.println("VendorError: " + ex.getErrorCode());
            } catch (Exception ex) {
                // handle the error
                System.out.println("Erro no registro do Driver Mysql!!!!");
            hide();
     * Password field select all.
     * Feild is select. The user can just start typing
     * and overright the password feild
     * @param focusGained FocusEvent
    public void passwordField_focusGained(FocusEvent focusEvent) {
        passwordField.selectAll();
class Login_loginButton_actionAdapter implements ActionListener {
    private Login adaptee;
    Login_loginButton_actionAdapter(Login adaptee) {
        this.adaptee = adaptee;
    public void actionPerformed(ActionEvent actionEvent) {
        adaptee.loginButton_actionPerformed(actionEvent);
class Login_passwordField_focusAdapter extends FocusAdapter {
    private Login adaptee;
    Login_passwordField_focusAdapter(Login adaptee) {
        this.adaptee = adaptee;
    public void focusGained(FocusEvent focusEvent) {
        adaptee.passwordField_focusGained(focusEvent);
class Login_cancelButton_actionAdapter implements ActionListener {
    private Login adaptee;
    Login_cancelButton_actionAdapter(Login adaptee) {
        this.adaptee = adaptee;
    public void actionPerformed(ActionEvent actionEvent) {
        adaptee.cancelButton_actionPerformed(actionEvent);
}

Similar Messages

  • How to stop the Dialog from being dragged

    I was hoping that someone could tell me when calling a Dialog from Jframe, a how to stop the Dialog from being dragged
    while a dialog is showing.
    When it is visible I can still click and drag the Dialog
    I want to set it so you can not drag it until the dialog has be closed.

    If you don't have access to the parent frame, a "hack" that usually works:
    Frame frame = Frame.getFrames()[0];
    if (null != frame && frame instanceof JFrame){
    JFrame jf = (JFrame)frame;
    JDialog jd = new JDialog(jf, "title");
    ... code here ...
    As each JFrame (or Frame) is opened, its stored in the array of Frames that you can get. Same thing with Dialog.getDialogs(). Almost always, at least so far for me I've never had this problem, the [0] index is the main window opened, or the parent/top frame. I'd put the check in there to be safe and make sure its a JFrame and usually you'll only have the one JFrame.

  • I downloaded a movie to my ipad, when synced with computer, the computer is now also downloading the movie. why? and how do i stop the movie from being downloaded again

    i downloaded a movie to my ipad, when synced with computer, the computer is now also downloading the movie. why? and how do i stop the movie from being downloaded again

    Do you not want a backup of the iTunes content on your computer in the event the iPad is lost, stolen, or simply fails?

  • How can I stop the cursor from being dragged outside the bounds of an intensity graph in LV 7.1?

    Currently, an intensity graph cursor can be dragged outside the graph bounds, and the cursor position continues to change as if the graph had no bounds.

    You can maintain the cursor (and the graph scales...) between defined boundaries programmatically, using an attribute node. Not a very elegant solution, since there is some quivering. See the example.vi.
    Of course, if the user need to modify the scales (zoom in/out...), there will be some additional work ! :-)
    Hope this help.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Bound_cursor.vi ‏51 KB

  • Can i stop the ipone from being restored without my knowledge?

    I am the Internet Safety Manager for our Non Profit organisation and want to know if there is a way of restricting the ability to "restore" the iphone.
    Even when you have the "Restrictions" active they can be easily by passed by just doing a restore. Can i set the iphone or iTunes to send me an email if a restore is done or can i restrict it altogether, or can i put a password on the Restore function?

    Find My Phone REQUIRES an internet connection in order to work. Either WiFi or Cellular Data. So, if you turn off Cellular data, you're defeating Find My Phone.

  • Stop the mouse from leaving swf

    Is there any way to stop the cursor from being able to leave
    a swf until a certain action has been completed ie roll over a
    button

    Wow nice responses. I have two questions:
    1) What is native code?Write the code to capture the mouse in C/C++ (Windows supports capturing the mouse cursor - dunno about linux or solaris), then write a JNI wrapper function so you can call it from within Java.
    >
    2) Is it difficult to make it full screen? I was
    thinking of doing that but the thought of rescaling
    everything (i.e. fonts, images etc) made me think
    otherwise.Fullscreen is easy, simply graphicsDevice.setFullscreenWindow(window);
    Once in fullscreen, you can change the resolution to whatever you like (limited to what is supported by the gfx card ofcourse :p), so you shouldn't have to worry about rescaling gfx 2much.
    >
    Thanx,
    Jon

  • How to stop an idoc from being processed further

    Hi Experts,
    I have a requirement where i have to stop the idoc from being processed in an user exit.
    I have to stop the idoc and give a suitable status message over there.
    It would be highly helpful if anybody tells me how to stop the idoc abruptly and giv the status messsage.
    Thanks in advance.
    Praveen.

    Hi,
    Check the below link
    https://forums.sdn.sap.com/click.jspa?searchID=11810720&messageID=3032674
    You need to find aproper EXIT.
    The avaliable options for you in the exit is
    IDOC_DATA
    Now if i pick the segment having shiped qty from the data record and check the same with the delivery qty your objective is half done.
    When the condition fails you need to update the IDOC with Error 51 saying that this is not possible .
    for that you need to bring your logic as
    LOOP AT IDOC_CONTROL.
    PERFORM LOGIC...
    ENDLOOP.
    FOR LOGIC .
    All the criteria and then update the status of the IDOC then error is generated and updated to the IDOc.
    PERFORM updatestatusidoc.
    endform logic.
    like this in
    form updatestatusidoc.
    IF subrc = 0 .
    t_idoc_status-docnum = f_idoc_contrl-docnum.
    t_idoc_status-status = c_idoc_status_ok.
    t_idoc_status-msgty = 'S'. -
    >denotes success
    t_idoc_status-msgid = 'ZXXX'.
    t_idoc_status-msgno = '000'. "
    t_idoc_status-msgv1 = itab-field.
    APPEND t_idoc_status.
    ELSEIF subrc = 1.
    t_idoc_status-docnum = f_idoc_contrl-docnum.
    t_idoc_status-status = c_idoc_status_error.
    t_idoc_status-msgty = 'E'. "denotes --->error
    t_idoc_status-msgid = 'ZXXX'.
    t_idoc_status-msgno = '001'. "
    t_idoc_status-msgv1 = itab-field.
    APPEND t_idoc_status.
    endif.
    endform.
    this has to be done to make the idoc to trigger error mode.
    Regards,
    Raj.

  • Something software related prevented me from being able to boot up my iMAC. The remedy was to wipe the computer of all soft wear and re-inatall everything via my time capsule. All good there.. but now I cannot open Ai and a box stating"Licensing for this

    Something software related prevented me from being able to boot up my iMAC. The remedy was to wipe the computer of all soft wear and re-inatall everything via my time capsule. All good there.. but now I cannot open Ai and a box stating"Licensing for this product has stopped working" and to reference error code 150:30. How do I get my Ai to open?

    Run the cleaner tool and reinstall it properly.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Download CS6 products
    Mylenium

  • HT4914 I often record songs at a particular tempo, iTunes Match will then match it and send it back to me at the original tempo, is there anyway I can stop some songs from being matched. At the moment I have turned match off. But I would like to sync play

    I often record songs at a particular tempo, iTunes Match will then match it and send it back to me at the original tempo, is there anyway I can stop some songs from being matched. At the moment I have turned match off. But I would like to sync playlists.

    How old was this backup? It sounds like it was at least several weeks old.
    You can look directly in the TM backup for the music.
    1. Connect to the external HDD the backup is kept on.
    2. Open a Finder window and select the backup drive in the left hand panel. Double click into the folders until you see a list of folders with dates.
    These are the incremental backups. You can start at the top or the bottom of the list but I suggest you double Latest/<HDD Name>/Users/<Account Name>/Music/iTunes/iTunes Media/Music. From this location you can start looking for the "missing" music. When/if you find it you can simply drag-n-drop to ~/Music/iTunes/iTunes Media/Music on the internal HDD.
    If the music is actually not in the backups (for whatever reason) then you've got a problem.
    You can download the uploaded files from the cloud by deleting the affected tracks from the iTunes library (but not the cloud!), highlighting multiple tracks at once, right-clicking and choosing "download."

  • All my contact are being copied to my friend's iphone and i also am getting his contacts on my phone,when i delete a contact it also deletes it from his phone,we are sharing the same apple ID. How can i stop our contacts from being shared between us

    All my contact are being copied to my friend's iphone and i also am getting his contacts on my phone,when i delete a contact it also deletes it from his phone,we are sharing the same apple ID. How can i stop our contacts from being shared between us

    Everything that you have checked in your icloud settings will be shared between devices using the same Apple ID.  If you don't want icloud to share that information, then simply turn off that process under settings > icloud

  • Is there a way to stop the OS from switching to a newly opened app?  I would like to be able to continue what I'm doing while I wait for an app to launch and not get interrupted by a forced entry into the app.

    Is there a way to stop the OS from switching to a newly opened app?  I would like to be able to continue what I'm doing while I wait for an app to launch and not get interrupted by a forced entry into the app.
    As an example, I'm going to my email in safari, while I wait for it to load, I open an excel document, and the OS decides excel should be the front app, so I go back to safari so I can enter my login info, but halfway through my password the OS decides that excel is where I should finish typing my password.
    VERY ANNOYING.  Can I open apps in the background?

    Thank you everyone for the suggestions. J D, I'm not a terminal fan, but I'm sure it works.  I found a solution that I can use in the dock from another post. 
    Annoyed by Mac OS
    Works great and allows me to maximize those multitasking minutes.

  • I had a free trial of Lightroom 5 and tried to purchase it, but page errors blocked me from being able to do this. I then got a free trial of Adobe CC.  At first I saw my old photos, then the whole thing went down, and now I have a new Lightroom 5 trial,

    I had a free trial of Lightroom 5 and tried to purchase it, but page errors blocked me from being able to do this. I then got a free trial of Adobe CC.  At first I saw my old photos, then the whole thing went down, and now I have a new Lightroom 5 trial, and none of my edited photos.  Can I retrieve all these photos from my first trial?

    Yes, you have to find the catalog file from the CC trial (use your operating system to search for it, the file name ends with .LRCAT), and then once you find it, open the LR5 trial and open the catalog you just found using File->Open Catalog

  • Just brought my daughter an iphone and have her setup on my ID. Want to be able to see her messages and photos but dont want my info to appear on her phone. How do i stop the messages from appearing on her phone? (5's)

    Just brought my daughter an iphone and have her setup on my ID. Want to be able to see her messages and photos but dont want my info to appear on her phone. How do i stop the messages from appearing on her phone?

    If you have set up photo stream, this can't be done. As soon as you switch off photo stream on her device to keep your photos from coming to her device, you won't get any as well from her. Same for messages, you can't have both, sorry.
    Maybe look into the family sharing feature if you want the photos to be shared:
    Apple - iCloud - Family Sharing

  • Is there a way of stopping the battery from charging?

    Dear Apple Community,
    Recently I installed iStat Menus and found that, over the course of this year, my Macbook's charging capacity has dropped 5%. I know this isn't a massive number, but battery performance has become a concern for me. I use my Macbook as a desktop replacement, on the main. It's sitting on a mStand, connected to a large monitor on my desk. I use my Macbook to play games, surf the internet, do work and all that good stuff - basically, I use it for everything. I rarely use the Macbook without it being plugged in. I read on the Apple website that they do not recommend leaving the Macbook on charge permanently and that I should use it on battery at least one a month. As I use my Macbook as a desktop replacement, I don't actually have a lot of opportunity to do this.
    My question to you, the community, is: is there a way of stopping the battery from charging, either with the use of an app or a physical device? Ideally, I would love to have my power plugged in BUT only used when the battery drops below 10%. Is this possible with an app?
    On the other hand, am I just worrying about nothing? Will my battery be damaged further if I leave the Macbook charging permanently?
    Thanks for your help!
    Jeremy Reid

    Ideally, I would love to have my power plugged in BUT only used when the battery drops below 10%. Is this possible with an app?
    The charging characteristics are handled in firmware.  There is no app that would be able to do this.  You actually would not want to do this anyway.  Regularly discharging your battery to 10% will greatly decrease the life of your battery.  While it is true that you should not use your system exclusively plugged in, allowing it to run on battery a few hours a week should be fine.  Letting the battery regularly run down to (or below) 10% will cause you to use up cycles more quickly than is necessary (thereby reducing the life of your battery).  It's really a only a matter of disconnecting your Magsafe connector once in a while.
    Leaving it plugged in does not result in it being charged "permanently".  It will charge until it is full and then charging will stop.  It will only begin recharging when it reaches about 95%.

  • How to stop an email from being sent after I hit send?

    How can I immediately stop an email from being sent after clicking "send"?
    I can't seem to find any info on this. I am assuming that it is impossible. Correct?

    When sending the emails with larger attachments that take a little time to actually upload and get out, you can open the activity viewer by pressing command-0 (or is it command-o?--)--it may also be under the window menu at the top--I'm not at my Mac right now to check. The activity viewer has a stop button on it. After you stop it, you should be able to either delete the email from the outgoing mail folder or drag that email to another folder, such as the drafts folder. I've done this a few times without a problem.

Maybe you are looking for

  • The requested url was not found on this server is displayed when trying to play a video I paid for on itunes

    When I try to play my itunes videos that I downloaded it says that "This requested url was not found on this server."  Why?  I paid for it, it s/b stored on my phone in itunes.  It was working fine 2 weeks ago.  I am using my iphone 4

  • Firefox is already running

    We have a lab of 60 emacs. I would like to install Firefox. I downloaded on my presentation machine, installed, it worked. I then got info on the app and made sure everyone had read write privledges. When I sent the app out via ARD, and launch I get

  • Sound Issue Windows 7 on iMac mid-2007

    I am having trouble getting my audio to work on Windows 7 on my mid-2007 20" iMac.  I do not have the drivers for this.  I had Windows 7 installed by a friend of mine and I did not notice the audio was not working till today.  Does anyone know where

  • Printing multiple copies

    HI All I need to print a layout twice. On first layout i should be able to print a text ORIGINAL and on second layout shuld be able to print text duplicate. Please suggest me how can i do this. Thanks in advance Pavan.

  • N86 active standby plugin area

    Hi, are you able to remove or change the items shown in active standby plugin area? Of the 4 items on the screen, I will never use chat or share my photos and can't set up email making all three options unnecessary. Any ideas?