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 !

Similar Messages

  • How to set an icon in title bar and minimized window

    I would like to set my own icon in the title bar and in the minimized window of my java application, replacing the java coffee cup icon.
    I am using:
    frame.setIconImage(new ImageIcon("image.gif").getImage())
    as was suggested previously in this forum at:
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=5212059
    This does create the icon in both places. However, it only works when I run the program from JBuilder 2006. It doesn't work if I run the program from the .jar or the .exe file.
    How can I make it work for my .jar and .exe file?
    Please help! Thanks!

    BrigitAnanya wrote:
    This is urgent! What? Replacing an icon is urgent? That's ridiculous.
    Can anyone tell me how I can replace Sun's Java Icon?The way you were already told. Only if you aren't going to put the icon in your current working directory, don't write code that assumes the icon is in your current working directory.

  • How to add mouse listener for a single row alone

    I have a requirement. In a JTable when I double click a particular row the cells in the row should set to the width which I have provided.
    The problem with my code is when I click fourth row in the table, the first row gets adjusted.
    So how I need help is
    only if I click the first row, the first row cell size should get adjusted not when I click fourth row.
    Similarly if I give some cell width and height for fourth row cells, then when I double click the fourth row, the fourth should alone get adjusted and not the other rows.
    Hope I have explained clearly.
    How can it be achieved?
    Please find below my code. Everything is hardcoded. So it may look messy. Please excuse.
    // Imports
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    class SimpleTableExample extends JFrame {
    // Instance attributes used in this example
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
         // Set the frame characteristics
         setTitle("Simple Table Application");
         setSize(400, 200);
         setBackground(Color.gray);
         // Create a panel to hold all other components
         topPanel = new JPanel();
         topPanel.setLayout(new BorderLayout());
         getContentPane().add(topPanel);
         // Create columns names
         String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
         // Create some data
         String dataValues[][] = { { data1, data2, "67", "77" },
              { "", "43", "853" }, { "", "89.2", "109" },
              { "", "9033", "3092" } };
         DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
         model.addColumn("PART TITLE");
         model.addColumn("SPECIAL INSTRUCTIONS");
         table = new JTable(model) {
         public boolean isCellEditable(int rowIndex, int colIndex) {
              return false;
         // set specific row height
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         int colInd = 0;
         TableColumn col = table.getColumnModel().getColumn(colInd);
         int width = 50;
         col.setPreferredWidth(width);
         int colInd2 = 1;
         TableColumn col2 = table.getColumnModel().getColumn(colInd2);
         int width2 = 100;
         col2.setPreferredWidth(width2);
         int colInd3 = 2;
         TableColumn col3 = table.getColumnModel().getColumn(colInd3);
         int width3 = 10;
         col3.setPreferredWidth(width3);
         int colInd4 = 3;
         TableColumn col4 = table.getColumnModel().getColumn(colInd4);
         int width4 = 10;
         col4.setPreferredWidth(width4);
         int colInd5 = 4;
         TableColumn col5 = table.getColumnModel().getColumn(colInd5);
         int width5 = 10;
         col5.setPreferredWidth(width5);
         table.addMouseListener(new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2) {
              JTable target = (JTable) e.getSource();
              int row = target.getSelectedRow();
              int column = target.getSelectedColumn();
              TableColumn col1 = table.getColumnModel().getColumn(0);
              col1.setPreferredWidth(50);
              TableColumn col2 = table.getColumnModel().getColumn(1);
              col2.setPreferredWidth(400);
              table.getColumnModel().getColumn(1).setCellRenderer(
                   new TableCellLongTextRenderer());
              table.setRowHeight(50);
              TableColumn col5 = table.getColumnModel().getColumn(4);
              col5.setPreferredWidth(200);
         // Create a new table instance
         // table = new JTable(dataValues, columnNames);
         // Add the table to a scrolling pane
         scrollPane = new JScrollPane(table);
         topPanel.add(scrollPane, BorderLayout.CENTER);
    // Main entry point for this example
    public static void main(String args[]) {
         // Create an instance of the test application
         SimpleTableExample mainFrame = new SimpleTableExample();
         mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
         boolean isSelected, boolean hasFocus, int row, int column) {
         this.setText((String) value);
         this.setWrapStyleWord(true);
         this.setLineWrap(true);
         // set the JTextArea to the width of the table column
         setSize(table.getColumnModel().getColumn(column).getWidth(),
              getPreferredSize().height);
         if (table.getRowHeight(row) != getPreferredSize().height) {
         // set the height of the table row to the calculated height of the
         // JTextArea
         table.setRowHeight(row, getPreferredSize().height);
         return this;
    Edited by: 915175 on Aug 3, 2012 4:24 AM

    Hi
    Try below code. Hope this will help
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    public class SimpleTableExample extends JFrame {
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
    // Set the frame characteristics
    setTitle("Simple Table Application");
    setSize(400, 200);
    setBackground(Color.gray);
    // Create a panel to hold all other components
    topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    getContentPane().add(topPanel);
    // Create columns names
    String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
    // Create some data
    String dataValues[][] = { { data1, data2, "67", "77" },
    { "", "43", "853" }, { "", "89.2", "109" },
    { "", "9033", "3092" } };
    DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
    model.addColumn("PART TITLE");
    model.addColumn("SPECIAL INSTRUCTIONS");
    table = new JTable(model) {
    public boolean isCellEditable(int rowIndex, int colIndex) {
    return false;
    // set specific row height
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    int colInd = 0;
    TableColumn col = table.getColumnModel().getColumn(colInd);
    int width = 50;
    col.setPreferredWidth(width);
    int colInd2 = 1;
    TableColumn col2 = table.getColumnModel().getColumn(colInd2);
    int width2 = 100;
    col2.setPreferredWidth(width2);
    int colInd3 = 2;
    TableColumn col3 = table.getColumnModel().getColumn(colInd3);
    int width3 = 10;
    col3.setPreferredWidth(width3);
    int colInd4 = 3;
    TableColumn col4 = table.getColumnModel().getColumn(colInd4);
    int width4 = 10;
    col4.setPreferredWidth(width4);
    int colInd5 = 4;
    TableColumn col5 = table.getColumnModel().getColumn(colInd5);
    int width5 = 10;
    col5.setPreferredWidth(width5);
    // Cell Render should apply on each column -- add by Rupali
    for(int i=0; i< table.getColumnModel().getColumnCount(); i++){
    table.getColumnModel().getColumn(i).setCellRenderer( new TableCellLongTextRenderer());
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
    JTable target = (JTable) e.getSource();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    setTableCellHeight(table,row,column); //Added by Rupali
    TableColumn col1 = table.getColumnModel().getColumn(0);
    col1.setPreferredWidth(50);
    TableColumn col2 = table.getColumnModel().getColumn(1);
    col2.setPreferredWidth(400);
    TableColumn col5 = table.getColumnModel().getColumn(4);
    col5.setPreferredWidth(200);
    // Create a new table instance
    // table = new JTable(dataValues, columnNames);
    // Add the table to a scrolling pane
    scrollPane = new JScrollPane(table);
    topPanel.add(scrollPane, BorderLayout.CENTER);
    * Created By Rupali
    * This will set cell's height and column's width
    * @param table
    * @param row
    * @param column
    public void setTableCellHeight(JTable table, int row, int column) {
    // set the JTextArea to the width of the table column
    setSize(table.getColumnModel().getColumn(column).getWidth(),
    getPreferredSize().height);
    if (table.getRowHeight(row) != getPreferredSize().height) {
    // set the height of the table row to the calculated height of the
    // JTextArea
    table.setRowHeight(row, getPreferredSize().height);
    // Main entry point for this example
    public static void main(String args[]) {
    // Create an instance of the test application
    SimpleTableExample mainFrame = new SimpleTableExample();
    mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    this.setText((String) value);
    this.setWrapStyleWord(true);
    this.setLineWrap(true);
    return this;
    }

  • 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.

  • How to get standard Windows (7) title bars in Visual Studio 2013 Express?

    With the "title bar" background color changing when active vs inactive like all my other Windows.
    Using Win 7 in "Windows Classic" theme.

    Hi sponge_bob_128,
    >>How to get standard Windows (7) title bars in Visual Studio 2013 Express?
    Based on your issue, could you please tell me more detailed message about your issue.
    For example:
    (1)What did you would like to do in the Visual Studio 2013 Express?
    (2) If you want to develop a program like the "title bar" background color changing when active vs inactive from the VS2013 Express.
    Generally, I know that when we set the theme as "Windows Classic" theme on the Windows 7 and then start two VS windows, it will show an active VS window like the following screen shot.
    To further help you solve this issue, please tell me more detailed message for me.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Fix colour for title bar

    how to make title bar have a fix colour for every OS platform ?

    I think you can.
    Have a look at
    setDefaultLookAndFeelDecorated() in the
    Javadocs of JFrame and JDialog.
    Regards,
    Timno, using LookAndFeel will make the colour of title bar dynamic, i will have different colour for different OS.
    i want to set a specific colour for title bar in top level container component (JFrame or JDialog), then it will be the colour for every OS and the colour will not change even user set different colour scheme.

  • How to set a hover for Accordion content?

    Hello,
    I'm trying to figure out how to make a vertical side navigation using the accordion feature.
    I've got it all working for what I want to do except for a hover on content.
    I have it set for hover on the labels so it shows the blue bar and yellow text on hover or open like I want.
    What I'd like now is to have a background on each content line when I hover on it (and when selected it stays the background shown on hover).
    I've got a background image for the yellow gradient highlight shown below, but can't figure out how to set the Content for hover like I did the Top Level Tab.
    I'm attaching a couple of files for demonstration in case the above is not clear.
    thanks!
    kim

    Use the css :hover..
    http://www.daniweb.com/forums/thread109916.html#

  • How to set enviroment variables for Inso Filter

    Hi everyone,
    I want to convert word documents to html using CTX_DOC.Filter.According to the documentation,I know I neednot set the 'Inso Filter'in the preference when creating index,but I must set enviroment variables for Inso Filter.
    I found the following instructions for it in the 8.1.5 documentation,but I can't understand it well.Is there anyone can tell me how to set enviroments variables for Inso Filter on Windows2000 Server?(My DB version is 8.1.7EE)
    Environment Variable Locations
    All environment variables related to Inso filtering must made visible to interMedia Text. Set these variables in the following locations:
    listener.ora file. This makes the environment variables visible to the extproc PL/SQL process.
    The operating system shell from where ctxsrv server is started. This makes the environment variables visible to the ctxsrv process, which does background DML.
    Any suggestions are apreciated
    Reemon
    null

    NSAPI plugins are normally configured using parameters specified in magnus.conf and/or obj.conf. What plugin requires you set an environment variable?

  • How to set Shortcut keys for button in Apex

    Hi
    Could anyone help me on how to set shortcut keys for buttons in Apex.
    I need to use say ALT + S to submit the page.
    The following thread pertaining to HTML DB refered to use ACCESS key. but that couldnt work in my case.
    Re: operation of the app. with the keyboard
    Any pointers on achieving this would be helpful.
    Thanks
    Vijay

    Hi Vijay,
    I’m afraid you must do it using javascript key listener. You can’t use action() on template based buttons because they are actually not HTML buttons but images with hyperlink.
    Key listener checks which key has been pressed down and invoke some JS function. For example, write this code in page header:
    <script>
    document.onkeydown=keyCheck;
    function keyCheck(e){
         var KeyId = (window.event) ? event.keyCode : e.keyCode;
         switch(KeyId){         
              case 113:
                   doSubmit('SAVE');
                   break;                    
              case 118:
                   alert('Hello');
                   break;
    </script>
    This script will submit page with request 'SAVE' if you press F2 or will show alert message if you press F7. Modify it to your issue.
    Regards,
    Przemek

  • How to set Compatibility Mode for a single site in ie10

    This question was originally posted on the Answers forum -
    http://answers.microsoft.com/en-us/ie/forum/ie10-windows_7/how-to-set-compatibility-mode-for-a-single-site-in/187152e3-142a-4d96-8d1b-af82ef571eec
    I am having problem with getting ie10 to set ie9 compatibility for a single site (sharepoint.contoso.com).
    When I add this website in Compatibility View Settings (Alt > Tools > Compatibility View Settings > 'Add this Website') it adds the domain 'contoso.com' and not the individual website (sharepoint.contoso.com).
    This cause other sites (www.contoso.com) to be configured to use compatibility mode. Because this is a separate site (different web server) to the site sharepoint.contoso.com (sharepoint 2010 server) we need different compatibility settings.
    Using a different example to explain the issue -
    Microsoft has three websites that are different websites created by different developers written in different programming languages and they only work with certain browsers.
    microsoft.com (Website1 created by Developer1) - compatible with ie8/ie9/ie10
    msdn.microsoft.com (Website2 created by Developer2) - compatible with ie8/ie9
    technet.microsoft.com (Website3 website created by Developer3) - compatible only with ie10
    The only thing the three website share is the URL contains 'microsoft.com'.
    Marking 'msdn.microsoft.com' to run in compatibility mode affects the other 2 websites - mainly technet.microsoft.com which will not work now since it only runs in pure ie10 mode. 
    Should you be able to add an individual site to the compatibility list instead of all sites that have  .microsoft.com in the URL? Am I missing a simple setting in the ie10?
    As a workaround I am using the F12 Developer Tools to set the Browser Mode which temporary sets the compatibility mode. However this is not a nice solution to the end users at our organisation. 

    problem is not solved for non corporate environments...
    You could start your own thread.  Then if you got that answer and it was marked Answered you would have the ability to unmark it.  The OP of this one seems satisfied.  Also note that this is TechNet.  Consumers can get help on Answers
    forums.
    Robert Aldwinckle
    Oh! I wrote it wrong: I should have said: This is not solved for NON-AD environments. No demands what so ever to use Window 7/8 professional in a small corporation or on a big corporation with Island of smaller departments for example offshore.
    The problem is that the thread is not "Answered" by the OP, its is marked answered by a moderator (and same moderator that did the answer) so no way of telling if the OP is satisfied.
    But you are right in the fact that I am almost kidnapping the thread. But a complete answer would benefit all in this case I would presume.
    Regards
    /Aldus

  • How to set a   background for jFrame?

    Hai.i have a code for background image.i.e
    * TextOver.java
    * Created on June 23, 2008, 1:53 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class TextOver
    private static final String IMAGE_PATH =
    "http://upload.wikimedia.org/wikipedia/commons/b/b5/HMS_Cardiff_%28D108%29_1.jpg";
    private BufferedImage image;
    private JTextArea textarea = new JTextArea(20, 40);
    private JPanel mainPanel = new JPanel()
    @Override
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    if (image != null)
    g.drawImage(image, 0, 0, this);
    public TextOver()
    URL imageUrl;
    try
    imageUrl = new URL(IMAGE_PATH);
    image = ImageIO.read(imageUrl);
    Dimension imageSize = new Dimension(image.getWidth(), image.getHeight());
    mainPanel.setPreferredSize(imageSize);
    JScrollPane scrollpane = new JScrollPane(textarea);
    textarea.setOpaque(false);
    scrollpane.setOpaque(false);
    scrollpane.getViewport().setOpaque(false);
    mainPanel.add(scrollpane);
    catch (MalformedURLException e)
    e.printStackTrace();
    catch (IOException e)
    e.printStackTrace();
    public JPanel getPanel()
    return mainPanel;
    private static void createAndShowGUI()
    admin_login_code a=new admin_login_code();
    a.setVisible(false);
    JFrame frame = new JFrame("TextAreaOverImage Application");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new TextOver().getPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(false);
    public static void main(String[] args)
    javax.swing.SwingUtilities.invokeLater(new Runnable()
    public void run()
    createAndShowGUI();
    i want to give this backgground to my existing jFrame something like
    import java.sql.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class admin_login_code extends javax.swing.JFrame {
    String admin_name;
    String password;
    Connection con;
    Statement stmt;
    ResultSet rs;
    public admin_login_code() {
    initComponents();
    jPasswordField1.addKeyListener(new KeyAdapter() {
    public void keyTyped(KeyEvent e) {
    char c = e.getKeyChar();
    if (!(Character.isDigit(c) ||
    (c == KeyEvent.VK_BACK_SPACE) ||
    (c == KeyEvent.VK_DELETE))) {
    getToolkit().beep();
    e.consume();
    jFormattedTextField1.addKeyListener(new KeyAdapter() {
    public void keyTyped(KeyEvent e) {
    char c = e.getKeyChar();
    if (!(Character.isLetter(c) ||
    (c == KeyEvent.VK_BACK_SPACE) ||
    (c == KeyEvent.VK_DELETE))) {
    getToolkit().beep();
    e.consume();
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    jFormattedTextField1 = new javax.swing.JFormattedTextField();
    jLabel4 = new javax.swing.JLabel();
    jPasswordField1 = new javax.swing.JPasswordField();
    jPanel2 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36));
    jLabel1.setForeground(new java.awt.Color(255, 0, 0));
    jLabel1.setText("ADMIN LOGIN");
    jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24));
    jLabel2.setText("Admin Name");
    jFormattedTextField1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jFormattedTextField1ActionPerformed(evt);
    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24));
    jLabel4.setText("Password");
    jPasswordField1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jPasswordField1ActionPerformed(evt);
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPanel1Layout.createSequentialGroup()
    .add(39, 39, 39)
    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jLabel4)
    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 161, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(43, 43, 43)
    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPasswordField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
    .add(jFormattedTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))
    .addContainerGap())
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPanel1Layout.createSequentialGroup()
    .add(47, 47, 47)
    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(jFormattedTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .add(60, 60, 60)
    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jLabel4)
    .add(jPasswordField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    jButton1.setText("Login");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jButton3.setText("Exit");
    jButton3.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton3ActionPerformed(evt);
    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
    .add(38, 38, 38)
    .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 110, Short.MAX_VALUE)
    .add(jButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(55, 55, 55))
    jPanel2Layout.setVerticalGroup(
    jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(jPanel2Layout.createSequentialGroup()
    .add(38, 38, 38)
    .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
    .add(jButton3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
    .addContainerGap(30, Short.MAX_VALUE))
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(574, 574, 574)
    .add(jLabel1))
    .add(layout.createSequentialGroup()
    .add(459, 459, 459)
    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
    .addContainerGap(521, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(149, 149, 149)
    .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(43, 43, 43)
    .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .add(42, 42, 42)
    .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(250, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    private void jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) {
    private void jFormattedTextField1ActionPerformed(java.awt.event.ActionEvent evt) {                                                    
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    Object src=evt.getSource();
    if(src==jButton3)
    dispose();
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    Object src=evt.getSource();
    if(src==jButton1)
    admin_name=jFormattedTextField1.getText();
    password=jPasswordField1.getText();
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcle","scott","root");
    stmt=con.createStatement();
    rs=stmt.executeQuery("select admin_name,password from admin_registration where admin_name='chandana' and password='8989' ");
    while(rs.next())
    if(admin_name.equals(rs.getString(1))&&password.equals(rs.getString(2)))
    admin_registration a=new admin_registration();
    a.setVisible(true);
    dispose();
    else
    JOptionPane.showMessageDialog(null,"Please enter admin name & password ");
    catch(ClassNotFoundException e)
    e.printStackTrace();
    catch(SQLException e)
    e.printStackTrace();
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    admin_login_code a=new admin_login_code();
    a.setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton3;
    private javax.swing.JFormattedTextField jFormattedTextField1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPasswordField jPasswordField1;
    // End of variables declaration
    Can any one can help me how to set a background for jFrame?
    Thank you in advance.
    Edited by: forums.com on Jul 14, 2008 1:40 AM

    90% of the code you posted is not relevant to your question.
    If you want further help post a Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the problem.
    And don't forget to use code tags when posting code.

  • How to set default values for boolean columns

    I'm trying to deploy some content types and columns into a site with a feature. All it's ok, except that I'm trying to set a default value for boolean columns with no success.
    I've tried to set default value at column level:
    <Field ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DisplayName="Se publican noticias en español"
    Type="Boolean" Hidden="FALSE" Group="Columnas ShaCon" >
    <Default>TRUE</Default>
    </Field>
    and at content type level:
    <FieldRef ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DefaultValue="TRUE" Required="TRUE" />
    But in any case, when i create a new item with this content type, default value is applied.
    Can anyone tell how to set default values for boolean columns?
    Thanks in advance,
    Regards,
    Sergio

    In the field definition you can set
    <Default>1</Default>
    or
    <Default>0</Default>
    How to set the default value Null?

  • How to create a Platinum,Gold and Silver Customer and how to set different price for a single material based on customer?

    Hi All,
    How to create a Platinum,Gold and Silver Customer and how to set different price for a single material based on customer?
    Assume Material is Pen.
    While creating Sales Order in VA01 how to bring different price for the same material for Platinum,Gold and Silver Customers.
    Kindly help me out.
    Thanks,
    Renjith Jose

    A good place to start is http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
    Also, do a search in this forum on HttpURLConnection. That class allows you to use POST method to send form data to a web server.
    "Hidden" variables are only hidden in HTML. The HTTP that gets POSTed to the web server doesn't distinguish between hidden and not hidden. That is, the content you would write to the HttpURLConnection.getOutputStream() would be something like:
    hidden=1&submit=ok(Of course, the variable names would depend on what the web server was expecting from the form.)
    Also, be sure to set the Content-Type request parameter to "application/x-www-form-urlencoded"

  • How to set background color for selected days in DateChooser

    How to set background color for selected days. I created
    checkbox for each day [Son,Mon,Tue,Wed,Thu,Fri,Sat] and a
    DateChooser, I want to change the background color for the selected
    day when i click on a button after selecting the desired checkboxs
    [ monthly wise/yearly wise]
    Thanks in advance

    There is no button involved in the following code, but it may
    be of use to you:
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()">
    <mx:Script>
    <![CDATA[
    private var origColor:uint;
    private function init():void {
    origColor = dc.getStyle("selectionColor");
    public function setBackGrdColors(newColor:uint):void {
    dc.setStyle("selectionColor", origColor);
    if(dc.selectedDate){
    var dayOfWeek:Number = dc.selectedDate.day;
    else{
    return;
    switch(dayOfWeek) {
    case 0:
    if(sun.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 1:
    if(mon.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 2:
    if(tue.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 3:
    if(wed.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 4:
    if(thu.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 5:
    if(fri.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 6:
    if(sat.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    default:
    break;
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="center" verticalGap="20">
    <mx:DateChooser id="dc" textAlign="left"
    change="setBackGrdColors(cellColor.selectedColor)"/>
    <mx:HBox width="100%" horizontalAlign="center">
    <mx:CheckBox id="sun" label="Sun"/>
    <mx:CheckBox id="mon" label="Mon"/>
    <mx:CheckBox id="tue" label="Tue"/>
    <mx:CheckBox id="wed" label="Wed"/>
    </mx:HBox>
    <mx:HBox width="100%" horizontalAlign="center">
    <mx:CheckBox id="thu" label="Thu"/>
    <mx:CheckBox id="fri" label="Fri"/>
    <mx:CheckBox id="sat" label="Sat"/>
    </mx:HBox>
    <mx:HBox width="300" horizontalAlign="center">
    <mx:Label text="Background Color" />
    <mx:ColorPicker id="cellColor"
    selectedColor="#FF00FF"/>
    </mx:HBox>
    </mx:VBox>
    </mx:Application>

  • HT5622 hi. i bought iphone 5 witch was locked, i made factory reset and now phone asking apple ID and pasword witch i dont know. i was writing to seller but he is not answering me. how to set new account for my iphone 5 what i could use it?

    hi. i bought iphone 5 witch was locked, i made factory reset and now phone asking apple ID and pasword witch i dont know. i was writing to seller but he is not answering me. how to set new account for my iphone 5 what i could use it?

    The iPhone has a feature called "Activation Lock" described here:
    http://support.apple.com/kb/PH13695
    Without that Apple ID, you will not be able to use that iPhone.

Maybe you are looking for

  • File-transfer question?

    Hi. Ive just gotten an imac G5 and am getting ready to transfer some info from my old G3 (10.2.8) to the new mac. I'm a bit confused regarding the methods of transfer. My understanding is that the 2 most common methods are to either use a firewire ca

  • How to get mic level loud enough

    This is my first attempt at a "complete" iMovie...though have been fooling around with video and stills to practice. I was thinking about subtitles to make my video make sense, but then wanted to try narration instead. I got out my headset, usb Cyber

  • Function module to get the status of WBS elements IN Project Systems

    Hi, I am suppose to delete the WBS elements in PS depending on certain conditions. WBS elements that are to be deleted should satisfy the following conditions: 1.     Status of WBS elements should not be  ‘AUC’ construction 2. WBS element, which have

  • Function module to read the target groups associated to a profile

    Hi all, In a profile set, there can be number of profiles associated with  the profile set. FM BAPI_PROFILESET_GETDETAIL gives the list of description and guid of the profiles associated with the profile set. Now, a number of target groups can be ass

  • Smartform problem urgent

    When printing a performance review if a bullet point or number is used can a new line be created in smartforms. what is the option for it. i will award ur effort.