📄 viewsingleservernamespanel.java
字号:
package za.co.halo.SecureCommunications.gui.server;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import za.co.halo.SecureCommunications.FromRule;
import za.co.halo.SecureCommunications.Rule;
import za.co.halo.SecureCommunications.ServerAccount;
import za.co.halo.SecureCommunications.ServerAdmin;
import za.co.halo.SecureCommunications.SizeRule;
import za.co.halo.SecureCommunications.SubjectRule;
/**
* This code was generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* *************************************
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED
* for this machine, so Jigloo or this code cannot be used legally
* for any corporate or commercial purpose.
* *************************************
*/
public class ViewSingleServerNamesPanel extends javax.swing.JPanel {
private JLabel serverStatus;
private JLabel serverName;
private JLabel portNumber;
private JButton startButton;
private JButton stopButton;
private boolean isSelected;
private AbstractServer server;
/**
* Auto-generated main method to display this
* JPanel inside a new JFrame.
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
public ViewSingleServerNamesPanel(AbstractServer server, int index, Boolean isSelected, JButton startB, JButton stopB) {
this.server = server;
//this.index = index;
this.isSelected = isSelected;
startButton = startB;
stopButton = stopB;
initGUI();
}
private void initGUI() {
try {
if (isSelected)
{
setBackground(new Color(15,65,108));
if (server.isStarted())
{
startButton.setEnabled(false);
}
else
{
stopButton.setEnabled(false);
}
}
else
{
setBackground(new Color(21,118,146));
}
this.setPreferredSize(new java.awt.Dimension(300,64));
if (isSelected)
this.setBackground(new Color(15,65,108));
else
this.setBackground(new Color(21,118,146));
this.setLayout(null);
{
serverName = new JLabel();
serverName.setForeground(Color.white);
this.add(serverName);
serverName.setText(server.getServerName());
serverName.setBounds(7, 16, 153, 16);
}
{
serverStatus = new JLabel();
serverStatus.setForeground(new Color(152,162,165));
this.add(serverStatus);
serverStatus.setText(""+server.isStarted());
serverStatus.setBounds(150, 15, 77, 16);
}
{
portNumber = new JLabel();
portNumber.setForeground(new Color(152,162,165));
this.add(portNumber);
portNumber.setText(""+server.getPort());
portNumber.setBounds(260, 15, 130, 16);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -