frameworkthreads.java
来自「一个java RMI 调用的FrameWork, 由IBM提供」· Java 代码 · 共 291 行
JAVA
291 行
/*
* Copyright (C) 2001 Cooperative Software Systems, Inc. <info@coopsoft.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You received a copy of the GNU General Public License
* along with this software. For more information on GNU, see
* http://www.gnu.org or write to: the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
*
*/
public class FrameWorkThreads extends javax.swing.JFrame
{
public FrameWorkThreads()
{
// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.
//{{INIT_CONTROLS
setTitle("Queue Threads Data");
setDefaultCloseOperation(javax.swing.JFrame.DO_NOTHING_ON_CLOSE);
getContentPane().setLayout(null);
setSize(520,375);
setVisible(false);
QueText.setToolTipText("Enter a Queue Name");
getContentPane().add(QueText);
QueText.setBounds(24,24,200,30);
QueLabel.setText("Queue Name");
getContentPane().add(QueLabel);
QueLabel.setBounds(24,55,110,20);
RefreshButton.setText("Refresh");
RefreshButton.setActionCommand("Refresh");
RefreshButton.setToolTipText("Refresh the list");
getContentPane().add(RefreshButton);
RefreshButton.setBounds(370,24,140,40);
Msg.setText(" Enter a Queue name");
getContentPane().add(Msg);
Msg.setForeground(new java.awt.Color(128,0,0));
Msg.setBounds(20,335,480,30);
JScrollPane1.setOpaque(true);
getContentPane().add(JScrollPane1);
JScrollPane1.setBounds(24,120,310,204);
TheList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
JScrollPane1.getViewport().add(TheList);
TheList.setBounds(0,0,307,201);
ListLabel.setText("Id, (#_Proc\'d) - Status");
getContentPane().add(ListLabel);
ListLabel.setBounds(28,95,200,20);
//}}
Msg.setBorder(new javax.swing.border.EtchedBorder());
//{{INIT_MENUS
//}}
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
this.addWindowListener(aSymWindow);
SymAction lSymAction = new SymAction();
RefreshButton.addActionListener(lSymAction);
SymListSelection lSymListSelection = new SymListSelection();
TheList.addListSelectionListener(lSymListSelection);
//}}
}
/**
* Creates a new instance of JFrame1 with the given title.
* @param sTitle the title for the new frame.
* @see #JFrame1()
*/
public FrameWorkThreads(String sTitle)
{
this();
setTitle(sTitle);
}
/**
* The entry point for this application.
* Sets the Look and Feel to the System Look and Feel.
* Creates a new JFrame1 and makes it visible.
*/
static public void main(String args[])
{
try {
// Add the following code if you want the Look and Feel
// to be set to the Look and Feel of the native system.
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
}
//Create a new instance of our application's frame, and make it visible.
(new FrameWorkThreads()).setVisible(true);
}
catch (Throwable t) {
t.printStackTrace();
//Ensure the application exits with an error condition.
System.exit(1);
}
}
/**
* Notifies this component that it has been added to a container
* This method should be called by <code>Container.add</code>, and
* not by user code directly.
* Overridden here to adjust the size of the frame if needed.
* @see java.awt.Container#removeNotify
*/
public void addNotify()
{
// Record the size of the window prior to calling parents addNotify.
Dimension size = getSize();
super.addNotify();
if (frameSizeAdjusted)
return;
frameSizeAdjusted = true;
// Adjust size of frame according to the insets and menu bar
javax.swing.JMenuBar menuBar = getRootPane().getJMenuBar();
int menuBarHeight = 0;
if (menuBar != null)
menuBarHeight = menuBar.getPreferredSize().height;
Insets insets = getInsets();
setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height + menuBarHeight);
}
// Used by addNotify
boolean frameSizeAdjusted = false;
//{{DECLARE_CONTROLS
javax.swing.JTextField QueText = new javax.swing.JTextField();
javax.swing.JLabel QueLabel = new javax.swing.JLabel();
javax.swing.JButton RefreshButton = new javax.swing.JButton();
javax.swing.JLabel Msg = new javax.swing.JLabel();
javax.swing.JScrollPane JScrollPane1 = new javax.swing.JScrollPane();
javax.swing.JList TheList = new javax.swing.JList();
javax.swing.JLabel ListLabel = new javax.swing.JLabel();
//}}
FrameWorkThreads2 FrameWorkThreads21 = null;
//{{DECLARE_MENUS
//}}
void exitApplication()
{
this.setVisible(false); // hide the Frame
this.dispose(); // free the system resources
System.exit(0); // close the application
}
class SymWindow extends java.awt.event.WindowAdapter
{
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
if (object == FrameWorkThreads.this)
FrameWorkThreads_windowClosing(event);
}
}
void FrameWorkThreads_windowClosing(java.awt.event.WindowEvent event)
{
// to do: code goes here.
FrameWorkThreads_windowClosing_Interaction1(event);
}
void FrameWorkThreads_windowClosing_Interaction1(java.awt.event.WindowEvent event) {
try {
this.exitApplication();
} catch (Exception e) {
}
}
class SymAction implements java.awt.event.ActionListener
{
public void actionPerformed(java.awt.event.ActionEvent event)
{
Object object = event.getSource();
if (object == RefreshButton)
RefreshButton_actionPerformed(event);
}
}
void RefreshButton_actionPerformed(java.awt.event.ActionEvent event)
{
// to do: code goes here.
RefreshButton_actionPerformed_Interaction1(event);
}
void RefreshButton_actionPerformed_Interaction1(java.awt.event.ActionEvent event)
{
try {
// must enter a name
String que = QueText.getText();
// When no name
if ((que == null) ||
(que.length() < 1)) {
//
Msg.setText(" Enter a Queue Name first");
// done
return;
} // endif
// When no obj
if (FrameWorkThreads21 == null) {
// get obj
FrameWorkThreads21 = new FrameWorkThreads2();
} // endif
// user code end
FrameWorkThreads21.refreshButton(QueText, TheList);
// user code begin {2}
// the result of this:
switch (FrameWorkThreads21.getRefResult()) {
case 0: Msg.setText(" Connection failure");
break;
case 2: Msg.setText(" Invalid Queue Name");
break;
case 3: Msg.setText(" Refresh to Update");
// done
break;
} // end-switch
} catch (java.lang.Exception e) {
}
}
class SymListSelection implements javax.swing.event.ListSelectionListener
{
public void valueChanged(javax.swing.event.ListSelectionEvent event)
{
Object object = event.getSource();
if (object == TheList)
TheList_valueChanged(event);
}
}
void TheList_valueChanged(javax.swing.event.ListSelectionEvent event)
{
// to do: code goes here.
TheList_valueChanged_Interaction1(event);
}
void TheList_valueChanged_Interaction1(javax.swing.event.ListSelectionEvent event)
{
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?