GUI Questions from a newbie
x_at_a.c
Date: 03/01/04
- Previous message: Jacob Hallenborg: "Re: draw directed graph with nested panels"
- Next in thread: Karsten Lentzsch: "Re: GUI Questions from a newbie"
- Reply: Karsten Lentzsch: "Re: GUI Questions from a newbie"
- Reply: Andrew Thompson: "Re: GUI Questions from a newbie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 1 Mar 2004 23:47:06 +1100
Hi,
I am very new to Java and OOP although I have done procedural programing for
a few years now so sorry if this post is a real 'Duh!'
What I am wanting to do is have an application (not an applet) that will
allow me to call a PHP script on a remote server, return as xml a list of
media (audio, text, video) and show the list.
My question regards the interface I am trying to develop.
What I want is, when the app first load, have a main window that takes a
username and password and has a button to 'logs on'.
If the logon is successful the I would like the logon fields to be removed
(perhaps replaced with a single logout button) and the main frame to display
a list of media.
What I have been trying was to make a main window and dynamically update is
contents depending on what has been done.
I can build the main window and add the login pane but am unable to remove
the pane again and replace it with the list pane. Is what I am trying to do
feasible/possible/practical? All the demos and turorials I have looked at so
far seem to all run in the first view that is loaded.
Is there a better method to achieve what I want?
I have tried quite a few things (pane.remove(componet), removeAll()) but
nothing seems to happen (except that the button sticks) .
As I mentioned I am a long time scripter so it is still a very new minsdset
for me to be working with.
Any hints, tips, links, resources or words of encouragement will be greatly
appreciated.
Cheers
Xav
the code looks a little like this
---
//imports javax. swing, java.net, javaio, java.awt
public class MakeMain extends JFrame implements ActionListener{
Container mainPane;
LogPane logPane;
ListPane listPane;
MakeMain(){
super("Media List");
setSize(400, 600);
setVisible(true)
mainPane = getContentPane();
logPane=new LogPane();
logPane.logbutton.addActionListener(this);
mainPane.add(logPane);
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
// if evt source is the login button
//then test login. If login is true then clear window
//of login details and
}
boolean doLogin(String rURL, name, pass){
//call url with parameters
//xml is returned
//if valid list then return true
//else return false
}
public static void main(String[] args){
MainPane myMain = new MainPane();
}
}
class LogPane extends JPanel{
// define JLabels, JTextFields, JButton
LogPane()
{
//create and add 3 rows
//1 for username, 1 for pass, 1 for button
}
}
class ListPane extends JPanel{
//builds a list from the xml returned from the remote page
}
--
- Previous message: Jacob Hallenborg: "Re: draw directed graph with nested panels"
- Next in thread: Karsten Lentzsch: "Re: GUI Questions from a newbie"
- Reply: Karsten Lentzsch: "Re: GUI Questions from a newbie"
- Reply: Andrew Thompson: "Re: GUI Questions from a newbie"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|