From: | Dennis Gearon <gearond(at)cvc(dot)net> |
---|---|
To: | Ursula Lee <ursula(dot)lee(at)thales-is(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to set the background color of the JPanel in Java |
Date: | 2003-07-18 15:20:28 |
Message-ID: | 3F18103C.6040108@cvc.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
AHHHHHHHHHHHHHHHHhhh! Cough! Sputter! Java gobbledeegook!
Ursula Lee wrote:
> Hi all,
>
> Any idea on how to set the background color of the JPanel in Java
> Applet? A few questions here:
> 1. I have 3 panels on the JAVA applet, one for 2 buttons, one for
> user_id label and read text, one for password label and read text.
> In fact, I don't think I need 3 panels, but once I put everything into
> the same panel, they all collapse on the same line.
>
> Question: Any idea on how to display them correctly, I just want a
> normal display like:
>
> User_id ..............
> Password ................
>
> <Logon button> <Cancel Button>
>
> All displayed at the botton.
>
> 2. My applet now has white background color, and I have an image
> picture on it, but the rest of the space are still white.
> I am unable to use the function 'setBackground'.
>
> Any idea on how to change the color?
>
> 3. How to make the whole panel bigger to display on HTML?
>
> Here is a portion of my code:
>
> import javax.swing.*;
> import java.applet.*;
> import java.awt.*;
> import java.awt.event.*;
> import java.net.*;
> import java.util.*;
> import java.text.*;
>
> public class login extends JApplet implements ActionListener
> {
> public String getUID;
> public String getPWD;
> Image pic;
>
> private Label L_UID = new Label("User ID: ");
> private TextField UID = new TextField(20);
> private Label L_PWD = new Label("Password: ");
> private TextField PWD = new TextField(20);
>
> private Button loginButton = new Button("Logon");
> private Button cButton = new Button("Cancel");
> private Button quitButton = new Button("Quit");
>
> // setup display
> public void init()
>
> { Container contentPane = getContentPane();
> contentPane.setLayout(new BorderLayout());
> JLabel label = new JLabel(getParameter("gretting"),
> SwingConstants.CENTER);
> label.setFont(new Font("TimesRoman", Font.BOLD, 18));
> contentPane.add(label, "Center");
>
> PWD.setEchoChar('*');
>
> pic = getImage(getDocumentBase(), "pic.gif");
>
> loginButton.addActionListener(this);
> cButton.addActionListener(this);
> quitButton.addActionListener(this);
>
> JPanel panel1 = new JPanel();
> panel1.add(L_UID, "Left");
> panel1.add(UID, "Left");
> contentPane.add(panel1, BorderLayout.NORTH);
> panel1.setBackground(Color.gray);
>
> JPanel panel2 = new JPanel();
> panel2.add(L_PWD, "Center");
> panel2.add(PWD, "Center");
> contentPane.add(panel2, BorderLayout.CENTER);
> panel2.setBackground(Color.gray);
>
> JPanel panel3 = new JPanel();
> panel3.add(loginButton, "South");
> panel3.add(cButton, "South");
> panel3.add(quitButton, "South");
> contentPane.add(panel3, BorderLayout.SOUTH);
> panel3.setBackground(Color.gray);
>
> resize(300, 300);
>
> }
>
> public void paint(Graphics g)
> {
> g.drawImage(pic, 0, 70, 400, 300, this);
> }
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Tkach | 2003-07-18 15:50:29 | FATAL 2: open of /var/lib/pgsql/data/pg_clog/0EE3 failed: No such file or directory |
Previous Message | Dennis Gearon | 2003-07-18 15:18:56 | Re: Access 97 DB to Postgres Migration Questions |