GUI bafflement
Steve.Ball at avis-europe.com
Steve.Ball at avis-europe.com
Thu Oct 26 17:30:28 MEST 2006
Hi all,
I'm trying to implement the basic client in a multiple document application.
I'm not using JInternalFrames, since that would require some serious
modification of the mindterm code (as far as I can see) and I'm not quite
ready for that yet ...
I've got this far: my application's main page loads fine, then as a test,
spawns a new JFrame and makes itself invisible. The new JFrame hosts the
mindterm client and makes itself visible (just like in the BasicClient.java
example). This works fine, and when I close that window, the original main
window reappears quite happily.
If, however, I audaciously try and do the *exact same call* from another
place, a blank JFrame appears and will not close. Has anyone seen this
before?
<Code from main window>
private void doNewWindow(String serverName)
{
System.out.println("Doing new window");
ServerInfo server =
settings.getServerList().getServerInfo(serverName);
this.setVisible(false);
new SSHTerminalWindow(this, settings, server);
}
<This is the MouseListener attached to a JList that calls this method>
lstServerList.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
String selected =
lstServerList.getSelectedValue().toString();
System.out.println(selected);
doNewWindow(selected);
}
}
});
<First bit of SSHTerminalWindow - note resemblance to BasicClient example>
public class SSHTerminalWindow extends JFrame
{
private static final long serialVersionUID = 234982345l;
private SSH2Transport transport;
private SSH2SimpleClient client;
private SSH2ConsoleRemote console;
private LineReaderTerminal lineReader;
public SSHTerminalWindow(MainWindow main, Settings settings, ServerInfo
target)
{
super("SSH terminal");
TerminalWin terminal = null;
try
{
terminal = new TerminalWin(this);
RandomSeed seed = new RandomSeed();
terminal.addAsEntropyGenerator(seed);
setLayout(new BorderLayout());
add(terminal.getPanelWithScrollbar(),
BorderLayout.CENTER);
TerminalFrameTitle frameTitle =
new TerminalFrameTitle(this, "SSH-ing into " +
target.getServerName());
frameTitle.attach(terminal);
terminal.setClipboard(GlobalClipboard.getClipboardHandler());
addWindowListener(new WindowAdapter()
{
/**
* Overide corresponding function in
java.awt.event.WindowAdapter
*/
public void windowClosing(WindowEvent e)
{
System.out.println("Caught window close
event");
if(lineReader != null)
{lineReader.breakPromptLine("");}
if(console != null) { console.close();}
if(transport != null)
{
transport.normalDisconnect("User
disconnects");
}
}
});
// pack();
System.out.println("Making SSH terminal visible");
this.setVisible(true);
//main.setVisible(false);
setSize(300,300);
setLocation(44,50);
Many thanks in advance,
Steve Ball
**********************************************************************
This email and any attachment(s) may contain confidential and/or proprietary information and is for the intended recipient only. If an addressing or transmission error has misdirected this email, please notify the sender by replying accordingly. If you are not the intended recipient you should not copy, distribute or in any way make use of the information contained in this email and any attachment(s).
**********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mindterm.appgate.com/pipermail/mindterm-users/attachments/20061026/bf1b0179/attachment-0001.htm
More information about the Mindterm-users
mailing list