Displaying the username in the title bar of jframe

hi
how to display the username entered by the user in the title bar of jframe

I'm not sure what you mean by 'entered' but does the following help?
import javax.swing.*;
public class DisplayUserNameInTitleOfJFrame extends JFrame
    public DisplayUserNameInTitleOfJFrame()
        setTitle(System.getProperty("user.name"));
        setSize(640, 480);
    public static void main(String[] args)
        new DisplayUserNameInTitleOfJFrame().setVisible(true);
}

Similar Messages

  • How to change the color of a title bar

    Hello !
    I try to change the color from my title bars, but I fail.
    I tried to change the activeCaption value to an other colour, but that didn�t work. Currently I use a own LAF and set it with UIManager.setLookAndFeel("dpg.beans.GuiWindowsLookAndFeel");
    import javax.swing.UIDefaults;
    import com.sun.java.swing.plaf.windows.WindowsLookAndFeel;
    public class GuiWindowsLookAndFeel extends WindowsLookAndFeel {
      protected void initSystemColorDefaults(UIDefaults table) {
        String[] colors = {
           "activeCaption", "#B0171F" 
         loadSystemColors(table, colors, false);
    }I also used the complete stringarray from WindowsLookAndFeel and only changed that one color. Still no changes.
    Any ideas ?

    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        UIManager.put("activeCaption", new javax.swing.plaf.ColorUIResource(Color.YELLOW));
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame f = new JFrame();
        f.setSize(200,100);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • Removing the minimize button from Title bar...

    Hi,
    I have created an desktop application using swing. I dont need minimized button on title bar of the main window. I searched a lot but could not find a solution. Can I get some useful links.
    What can I do ?
    Thanks

    Actually I want if the application is minimized, its state should not changed to iconified but it simple because hidden. And using the tray icon's option if application is open, it simple make the application visible. I did not want the following case which is happening right now.
    Case:
    1. I Minimized the application
    2. My application state becomes the iconified and it becomes hidden (As I have implemented the windowlistener)
    3. I used trayicon's Open option (it simply visible the application)
    4. Application becomes visible, but it is in iconified state. Because previously its state has been changed due to minimized button.I want whenever the Open option of tray icon is used, application must be visible in Maximized state. That why I also did on action listener of Open option
                            application.setState(NORMAL);
                            application.setExtendedState(MAXIMIZED_BOTH);
                            application.setVisible(true);That's why I planned to removed the minimize button from Title bar. But if it not possible then how can I avoid changing state of application when minimized button is used.
    thanks
    Jawahar Nayak

  • How can I get the username of the person currently logged in?

    I have built a custom authentication scheme and I am building a form page and I would like to show the username of the person who is currently logged in? How can I do this......

    Use the <tt>APP_USER</tt> built-in substitution string.
    This value can be referenced in various ways, including the static text exact substitution method <tt>&APP_USER.</tt> which can be used in page and region templates to display the current user name.

  • Problem in changin the username at the Step Level

    Hi All,
    I had a small problem with background processing in SM37.I was trying to change a job which was running from my Id to some other Id which I needed to run from.I changed it successfully, but the problem is the job is running under new Id now, but all the steps related to that job are running under my id(i.e., old id) itself.Could anybody please help me out how to change the username at the step level also?
    Thanks in advance...
    Regards,
    Sravanthi

    hi
    ->Log on to the new Id and select the job which was running under old id.
    ->Then,make a duplicate copy of the job from the menu option Job->Copy.
    ->Now, it will ask for a name give the new name
    ->Now, that job will be under new id in Shcheduled status.
    with all the steps being under old id still.
    ->Now, again select that particular newly copied job and
    ->click on step,Select the step by clicking on it.
    ->And, now go to the menu option Job->Change,there u will be able to change the userid from the old one to the one which u wish to have.......That will work fine after releasing the job from Scheduled status to Release status.
    regards
    venkat

  • Is there a way to prevent AnyConnect from caching the username of the last person who connected to the VPN?

    Is there a way to prevent AnyConnect from caching the username of the last  person who connected to the VPN?

    This can be done via specifying the "RestrictPreferenceCaching" parameter as described in the Anyconnect Admin Guide here:
    By design, AnyConnect does not cache sensitive information to disk. Enabling this parameter extends this policy to any type of user information stored in the AnyConnect preferences.
    •Credentials—The user name and second user name are not cached.
    •Thumbprints—The client and server certificate thumbprints are not cached.
    •CredentialsAndThumbprints—Certificate thumbprints and user names are not cached.
    •All—No automatic preferences are cached.
    •false—All preferences are written to disk (default—behavior consistent with AnyConnect 2.3 and earlier).

  • I have Mac mini 2.0/2x2gb/2x500/AP/BT, and i forgot the username and the password. How can I resolve the problem?

    I have Mac mini 2.0/2x2gb/2x500/AP/BT, and i forgot the username and the password. How can I resolve this problem?

    The username is the name attached to your Home folder - /Users/username/. If you don't know the password then it can be changed but you will need the installer DVD that came with the computer for the installed version of OS X. You have not provided that information.

  • How to retrieve the username of the logged in user

    Hi, I've been looking for a possibility retrieve some user data like the username of the currently logged in user since yesterday but could not find anything proper. I'm relatively new to APEX. Could someone perhaps point me to an easy-to-understand document? I would be glad if it would also cover the basic of authentication and authorization schemes.

    Hi, thanks for your reply. I've already changed my handle but the system said that it would take about one hour for the change to be done.
    Actually I have the following situation. I have a table that associates IDs to names. The names are the same as the user names of the users in APEX. On an APEX-Page I have a select-box that lists all available IDs. What I want to do is to automatically pre-select the ID of the currently logged in user. So I have created an authentication scheme as described in the help using following options:
    Based on a pre-configured scheme from the gallery > Show Login Page and Use Application Express Account Credentials
    And then I made the new authentication scheme the application's current scheme. Then I went to the page definition and created a new process, selecting "On Load - After Regions" as "Process Point", and entered the following source:
    declare
    nID number;
    begin
    :P2_TEMP := :APP_USER; -- this is just for debug purposes
    select b.ID into nID from MYTABLE b where b.NAME = :APP_USER;
    :P2_ID := nID;
    exception
    when others then
    null;
    end;
    But it doesn't work. Since the text field P2_TEMP stays empty I believe I am doing something wrong with APP_USER. Anybody who can help me with that?
    Edited by: user10977071 on 05.04.2009 08:57

  • How to set mouse listener for title bar of JFrame ?

    Hi, all
    How to we can set mouse listener for title bar of JFrame ?
    Please help

    Again, why did you not state this in your original
    question? Do we have to ask you every time what your
    actual requirement is?
    As I said in your last posting, if you don't give us
    the reuqirement in you question we can't help you.
    Sometimes your solution may be on the right track
    sometimes it isn't. We waste time guessing what your
    are trying to do if you don't give us the
    requirement.
    I gave you the answer in your other posting on this
    topic. The AWTEventListener can listen to events
    other than MouseEvents.
    The Swing tutorial has a list of most of the events.
    Pick the events you want to listen for:
    http://java.sun.com/docs/books/tutorial/uiswing/events
    /handling.htmlthe first, i am sory because my requirement not clear so that it wasted everybody time.
    The second, thank for your answer
    The third, AWTEvenListener do not support listener event on title bar
    but ComponentListener can know when we can change frame position.
    please see below that ComponentListener can handle action:
    public void componentHidden(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Hidden");
        public void componentMoved(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Moved");
        public void componentResized(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Resized ");           
        public void componentShown(ComponentEvent e) {
            displayMessage(e.getComponent().getClass().getName() + " --- Shown");
        }Thanks for all supported your knowledge, you are great !

  • How can i change/set a new icon on title bar in JFrame

    hi
    i want to change the icon of title bar on JFrame
    plz help me as soon as possible.
    thankyou

    I took you longer to post you message than to read the api documentation on JFrame. There is a method dedicated to changing the icon of the JFrame.

  • Add new button on title bar of JFrame

    how can i add new button (like minimize, maximize and close) on title bar of JFrame.
    actually i want a new button for system try icon. if user click on this button JFrame will hide and system try icon will be visible

    Hi,
    Check out this Thread.
    Hope that help,
    Jack

  • Displaying Jtimer in the title bar of jframe

    we have an urgent requirement to display Time (should run continously) and Date in the title bar of the java
    application. Please give input..

    To update a frame's title, call setTitle:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TitleUpdater {
        public static void main(String[] args) {
            final JFrame f = new JFrame("TitleUpdater");
            JButton btn = new JButton("press here");
            btn.addActionListener(new ActionListener(){
                int count = 0;
                public void actionPerformed(ActionEvent evt) {
                    ++count;
                    f.setTitle("pressed: " + count + " times.");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(btn, BorderLayout.NORTH);
            f.setSize(400,100);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • How to draw on the title bar of JFrame ?

    Is there any way in which I can draw on the title bar of the JFrame. I want to display animation on the JFrame title bar. Is it possible in Swing! For example I want to display a set of concentric circles increasing and decreasing in radii.

    What child window are you referring to? Do you mean a browser window opened with web.show_document?
    If so, you can use javascript to hide browser toolbars and so on. Search the forum for some javascript examples where windows are opened with toolbar=no.

  • How can I change the color of a title bar?

    Ok, I have been looking for this answer for over a week now and nobody
    has yet given me an answer that works. So I am going to ask again.
    Here is a piece of code you can run to see what I am trying to do:
    public class RemoteDisplayFrame extends JFrame {
    public static final Color GRAY70 = new Color(179, 179, 179);
    public RemoteDisplayFrame() {
    super();
    public RemoteDisplayFrame(String title) {
    super(title);
         public void setBorderContent() {
    this.setUndecorated(true);
    JRootPane rootPane = this.getRootPane();
    rootPane.setWindowDecorationStyle( JRootPane.PLAIN_DIALOG );
    this.setRootPane( rootPane );
    public static void main( String [] args ) {
    RemoteDisplayFrame frame = new RemoteDisplayFrame( "Test Frame" );
    frame.setBorderContent();
    frame.pack();
    frame.show();
    Run this code and you should get a frame on your screen that has no
    close buttons, minimize buttons, or maximize buttons, and no menu.
    I want to change the title bar's color to a specific color.
    That color is GRAY70:
    public static final Color GRAY70 = new Color(179, 179, 179);
    If you have any idea on how to do this please do tell.

    AFAIK, you can't. I believe the title bar is rendered by the operating system, using the colors the user has chosen, consistently for all windows. Frankly, if your app could, it would annoy me, as I would still want all my windows to look consistent.

  • Any way to get at the title bar in JFrame?

    I'd like to either add a button to the title bar (title pane?) or override the behavior of the resize button. As far as I can tell, the LookNFeel classes don't allow you to add anything, just change colors, icons, etc. The WindowListener classes don't let you get at the resize button. I don't want to override Component.setSize() (that causes other problems), I just want to have the resize button do something different (or add another button).
    I'd appreciate any ideas!

    1) You could create your own frame that extends JWindow. This would be quite involved, since you'd need to make it respond to mouse drags, mouse resizing etc explicitly (if you wanted that functionality), but you would be able to add your own custom border, which you could make to look like a system border, or you could make comletely different.
    2) I don't know this could be persuaded to do what you want, but you could try adding a ComponentListener to the JFrame to check for resizes, and take action accordingly

Maybe you are looking for

  • Reducing Windows Background Processes

    I'm in charge of my company's data acquisition system and we've finally got everything running about how we want it to.  The last issue we're having is that whenever the screen updates the program slows down measureably.  I've got the program running

  • JRE vs OS TimeZone issues

    Hello, How the JRE picks timezones rules?. I have changed the timezone variable by adding new DST settings to GMT0BST,M2.5.0/2:00:00,M9.5.0/2:00:00 . I can see the current date on the system is increased by 1 hr based on the above settings. So that i

  • Signed applet to open local file problem with IE6 / Firefox

    Hello I have a signed applet to open a local file, with this code : try{    URL destination=null;    File f=new File(adresse);    destination=f.toURL();    AppletContext ac=applet.getAppletContext();    ac.showDocument(destination,"_blank"); catch (M

  • Multiple magsafe adapters not working with multiple mbps

    I have two retina macbook pro 13" laptops, the more recent one being a late 2013 model.  Neither one of them seems to respond to magsafe adapters consistently anymore (i've used four magsafe2 adapters and both machines).  light doesn't come on or som

  • Dropdown Lists

    I am new to this product...I am creating a form to be used by medical professionals for work.  Some of the choices in the lists of the drop down boxes are very long.  How do I get the box to show all of the characters when they are making their choic