📄 domainpanel.java
字号:
package za.co.halo.SecureCommunications.gui.server;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import za.co.halo.SecureCommunications.network.ServerSettings;
/**
* 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.
* *************************************
*/
/**
* @author
* This class presents the GUI for changing the domain
*/
public class DomainPanel extends javax.swing.JPanel {
private JLabel domainName;
private JTextField domainNameText;
private JButton saveAndCloseButton;
private ServerSettings settings;
/**
* The main method
* Use to:
* display this JPanel inside a new JFrame.
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
//frame.getContentPane().add(new DpmainPanel());
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
/**
* The AddGroupPanel constructor
* Use to
* initialize member variables
* initialize the build of graphical components
* @param serverSettings
* @return void
*/
public DomainPanel(ServerSettings serverSettings)
{
super();
this.settings = serverSettings;
initGUI();
}
/**
* initGUI method
* Use to:
* initialize the graphics
* @param void
* @return void
*/
private void initGUI() {
try {
this.setPreferredSize(new java.awt.Dimension(500, 500));
this.setLayout(null);
{
JPanel imagePanel = new ImagePanel("images/domain.png","accounts");
imagePanel.setLayout(null);
imagePanel.setBounds(0,0,625,83);
this.add(imagePanel);
domainName = new JLabel();
this.add(domainName);
domainName.setText("Domain Name");
domainName.setBounds(5, 105, 79, 30);
}
{
domainNameText = new JTextField(settings.getDomain());
this.add(domainNameText);
domainNameText.setBounds(91, 105, 180, 30);
}
{
saveAndCloseButton = new JButton(new SaveAction());
this.add(saveAndCloseButton);
saveAndCloseButton.setText("Save");
saveAndCloseButton.setBounds(5, 150, 84, 26);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* SaveAction class
* Provides the functionality of handling save actions.
*/
class SaveAction extends AbstractAction {
SaveAction() {
super("Save record");
}
/**
* actionPeformed method
* Use to:
* Handle save actions
* @param ActionEvent: the type of action
* @return void
*/
public void actionPerformed(ActionEvent arg0)
{
settings.setDomain(domainNameText.getText());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -