def buildgwinfo(self): self.gateways = { "Twisted": { "ident": JTextField(), "passwd": JPasswordField(), "host": JTextField("twistedmatrix.com"), "port": JTextField("8787"), "service": JTextField("twisted.words"), "persp": JTextField() }, "AIM": { "ident": JTextField(), "passwd": JPasswordField(), "host": JTextField("toc.oscar.aol.com"), "port": JTextField("9898") }, "IRC": { "ident": JTextField(), "passwd": JPasswordField(), "host": JTextField(), "port": JTextField("6667"), "channels": JTextField() } } self.displayorder = { "Twisted": [["Identity Name", "ident"], ["Password", "passwd"], ["Host", "host"], ["Port", "port"], ["Service Name", "service"], ["Perspective Name", "persp"]], "AIM": [["Screen Name", "ident"], ["Password", "passwd"], ["Host", "host"], ["Port", "port"]], "IRC": [["Nickname", "ident"], ["Password", "passwd"], ["Host", "host"], ["Port", "port"], ["Channels", "channels"]] }
def openRegister(self, event): self.frame2 = JFrame('Register', layout=None, size=(430, 300)) self.usernameLabel2 = JLabel('Username', bounds=(30, 60, 200, 30)) self.frame2.add(self.usernameLabel2) self.inputUsername2 = JTextField('', bounds=(110, 60, 250, 30)) self.frame2.add(self.inputUsername2) self.passwordLabel2 = JLabel('Password', bounds=(30, 100, 200, 30)) self.frame2.add(self.passwordLabel2) self.inputPassowrd2 = JPasswordField('', bounds=(110, 100, 250, 30)) self.frame2.add(self.inputPassowrd2) self.repasswordLabel2 = JLabel('Re-Password', bounds=(30, 140, 200, 30)) self.frame2.add(self.repasswordLabel2) self.reinputPassowrd2 = JPasswordField('', bounds=(110, 140, 250, 30)) self.frame2.add(self.reinputPassowrd2) self.registerButton2 = JButton('REGISTER', bounds=(240, 200, 100, 30), actionPerformed=self.onRegister) self.frame2.add(self.registerButton2) self.frame2.visible = True
def __init__(self, message, default, hidden=False): self._input_field = JPasswordField() if hidden else JTextField() self._input_field.setText(default) self._input_field.selectAll() panel = self._create_panel(message, self._input_field) pane = WrappedOptionPane(panel, PLAIN_MESSAGE, OK_CANCEL_OPTION) pane.set_focus_listener(self._input_field) _SwingDialog.__init__(self, pane)
class InputDialog(_SwingDialog): def __init__(self, message, default, hidden=False): self._input_field = JPasswordField() if hidden else JTextField() self._input_field.setText(default) self._input_field.selectAll() panel = self._create_panel(message, self._input_field) pane = WrappedOptionPane(panel, PLAIN_MESSAGE, OK_CANCEL_OPTION) pane.set_focus_listener(self._input_field) _SwingDialog.__init__(self, pane) def _get_value(self, pane): if pane.getValue() != OK_OPTION: return None return self._input_field.getText()
def loadStiData(idv): hostField = JTextField('',30); userField = JTextField('',30); passwordField = JPasswordField('',30); comps = ArrayList(); comps.add(JLabel("Database Host:")); comps.add(GuiUtils.inset(hostField,4)); comps.add(JLabel("User Name:")); comps.add(GuiUtils.inset(userField,5)); comps.add(JLabel("Password:")); comps.add(GuiUtils.inset(passwordField,5)); contents = GuiUtils.doLayout(comps, 2,GuiUtils.WT_N, GuiUtils.WT_N); contents =GuiUtils.inset(contents,5); ok = GuiUtils.showOkCancelDialog(None,'foo', contents, None); if(ok==0): return; url = 'jdbc:mysql://' + hostField.getText() +':3306/typhoon?zeroDateTimeBehavior=convertToNull&user='******'&password='******'DB.STORMTRACK', None);
def run(self): frame = JFrame('PasswordDemo', size=(215, 100), layout=FlowLayout(), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add(JLabel('Password:'******'\x00', # actionCommand = '<Enter>', actionPerformed=self.enter)) self.msg = frame.add(JLabel()) frame.setVisible(1)
def __init__(self): self.username = "" self.password = "" self.okPressed = False self.userField = JTextField(15) self.passField = JPasswordField(15) self.setTitle("Login") self.setModal(True) self.setAlwaysOnTop(True) self.setLocationRelativeTo(None) pane = self.getContentPane() pane.setLayout(GridLayout(4, 2)) pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick) pane.add(okButton) cancelButton = JButton("Cancel", actionPerformed=self.cancelClick) pane.add(cancelButton) self.pack()
def run(self): frame = JFrame('PasswordDemo', size=(215, 125), layout=FlowLayout(), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add(JLabel('Password:'******'Submit', actionPerformed=self.enter)) self.echoChar = self.pwd.getEchoChar() frame.add(JButton('Show', actionPerformed=self.showHide)) frame.add(JButton('Submit', actionPerformed=self.enter)) self.msg = frame.add(JLabel()) frame.setVisible(1)
class SwingLoginDialog(JDialog): def __init__(self): self.username="" self.password="" self.okPressed=False self.userField=JTextField(15) self.passField=JPasswordField(15) self.setTitle("Login") self.setModal(True) self.setAlwaysOnTop(True) self.setLocationRelativeTo(None) pane = self.getContentPane() pane.setLayout(GridLayout(4,2)) pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick) pane.add(okButton) cancelButton=JButton("Cancel", actionPerformed=self.cancelClick) pane.add(cancelButton) self.pack() def okClick(self, e): self.okPressed=True self.username=self.userField.getText() self.password=str(String(self.passField.getPassword())) self.setVisible(False) def cancelClick(self, e): self.okPressed=False self.setVisible(False) def getLoginInfo(self): if self.okPressed: return [self.username, self.password] return None
class SwingLoginDialog(JDialog): def __init__(self): self.username = "" self.password = "" self.okPressed = False self.userField = JTextField(15) self.passField = JPasswordField(15) self.setTitle("Login") self.setModal(True) self.setAlwaysOnTop(True) self.setLocationRelativeTo(None) pane = self.getContentPane() pane.setLayout(GridLayout(4, 2)) pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick) pane.add(okButton) cancelButton = JButton("Cancel", actionPerformed=self.cancelClick) pane.add(cancelButton) self.pack() def okClick(self, e): self.okPressed = True self.username = self.userField.getText() self.password = str(String(self.passField.getPassword())) self.setVisible(False) def cancelClick(self, e): self.okPressed = False self.setVisible(False) def getLoginInfo(self): if self.okPressed: return [self.username, self.password] return None
def __init__(self): self.frame = JFrame("Jython Twitter") self.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) self.loginPanel = JPanel(GridLayout(0, 2)) self.frame.add(self.loginPanel) self.usernameField = JTextField('', 15) self.loginPanel.add(JLabel("username:"******"password:"******"Please Log in") self.loginPanel.add(self.message) self.frame.pack() self.frame.visible = True
def __init__(self): self.connect() self.frame = JFrame("Welcome", defaultCloseOperation=JFrame.EXIT_ON_CLOSE, layout=None, size=(430, 300)) self.title = JLabel('ACCOUNTS', bounds=(0, 20, 430, 30), horizontalAlignment=0) self.frame.add(self.title) self.usernameLabel = JLabel('Username', bounds=(30, 60, 200, 30)) self.frame.add(self.usernameLabel) self.inputUsername = JTextField('', bounds=(110, 60, 250, 30)) self.frame.add(self.inputUsername) self.passwordLabel = JLabel('Password', bounds=(30, 100, 200, 30)) self.frame.add(self.passwordLabel) self.inputPassowrd = JPasswordField('', bounds=(110, 100, 250, 30)) self.frame.add(self.inputPassowrd) self.buttonLogin = JButton('LOGIN', bounds=(50, 180, 100, 30), actionPerformed=self.onLogin) self.frame.add(self.buttonLogin) self.registerButton = JButton('REGISTER', bounds=(240, 180, 100, 30), actionPerformed=self.openRegister) self.frame.add(self.registerButton) self.frame.visible = True
def __init__(self): self.username="" self.password="" self.okPressed=False self.userField=JTextField(15) self.passField=JPasswordField(15) self.setTitle("Login") self.setModal(True) self.setAlwaysOnTop(True) self.setLocationRelativeTo(None) pane = self.getContentPane() pane.setLayout(GridLayout(4,2)) pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick) pane.add(okButton) cancelButton=JButton("Cancel", actionPerformed=self.cancelClick) pane.add(cancelButton) self.pack()
def __init__(self): self.setLayout(GridBagLayout()) self.setBorder(make_title_border("API")) self.setAlignmentX(JPanel.LEFT_ALIGNMENT) self.status = StatusText(25) self.add(JLabel("Status :"), gridx=0) self.add(self.status, gridx=1) self.version = StatusText(25) self.version.set(context.version, bg=Color.GRAY) self.add(JLabel("Version :"), gridx=0) self.add(self.version, gridx=1) settings = context.settings txt_url = JTextField(25) txt_url.setText(settings.load("apiurl", "https://api.yeswehack.com/")) self.add(JLabel("API URL :"), gridx=0) self.add(txt_url, gridx=1) combo_auth = JComboBox((AuthMethod.anonymous, AuthMethod.email_pass)) combo_auth.setSelectedItem( settings.load("auth_method", AuthMethod.anonymous)) combo_auth.addActionListener( CallbackActionListener(self.auth_method_changed)) self.add(JLabel("Authentication :"), gridx=0) self.add(combo_auth, gridx=1) txt_mail = JTextField(25) txt_mail.setText(settings.load("email")) self.add(JLabel("Email :"), gridx=0) self.add(txt_mail, gridx=1) txt_pass = JPasswordField(25) txt_pass.setText(settings.load("password")) self.add(JLabel("Password :"******"remember", True)) self.add(JLabel("Remember password :"******"Connect") btn_connect.addActionListener(CallbackActionListener(self.submit)) self.add(btn_connect, gridx=1, anchor=EAST) self.inputs = { "apiurl": txt_url, "auth_method": combo_auth, "email": txt_mail, "password": txt_pass, "remember": check_remember, "connect": btn_connect, } self.setMaximumSize(self.getPreferredSize()) self.auth_method_changed() async_call(self.update_status)
def getUiComponent(self): aws_access_key_id = self.callbacks.loadExtensionSetting( "aws_access_key_id") aws_secret_accesskey = self.callbacks.loadExtensionSetting( "aws_secret_access_key") if aws_access_key_id: self.aws_access_key_id = aws_access_key_id if aws_secret_accesskey: self.aws_secret_accesskey = aws_secret_accesskey self.panel = JPanel() self.main = JPanel() self.main.setLayout(BoxLayout(self.main, BoxLayout.Y_AXIS)) self.access_key_panel = JPanel() self.main.add(self.access_key_panel) self.access_key_panel.setLayout( BoxLayout(self.access_key_panel, BoxLayout.X_AXIS)) self.access_key_panel.add(JLabel('Access Key: ')) self.access_key = JTextField(self.aws_access_key_id, 25) self.access_key_panel.add(self.access_key) self.secret_key_panel = JPanel() self.main.add(self.secret_key_panel) self.secret_key_panel.setLayout( BoxLayout(self.secret_key_panel, BoxLayout.X_AXIS)) self.secret_key_panel.add(JLabel('Secret Key: ')) self.secret_key = JPasswordField(self.aws_secret_accesskey, 25) self.secret_key_panel.add(self.secret_key) self.target_host_panel = JPanel() self.main.add(self.target_host_panel) self.target_host_panel.setLayout( BoxLayout(self.target_host_panel, BoxLayout.X_AXIS)) self.target_host_panel.add(JLabel('Target host: ')) self.target_host = JTextField('ifconfig.io', 25) self.target_host_panel.add(self.target_host) self.buttons_panel = JPanel() self.main.add(self.buttons_panel) self.buttons_panel.setLayout( BoxLayout(self.buttons_panel, BoxLayout.X_AXIS)) self.save_button = JButton('Save Keys', actionPerformed=self.saveKeys) self.buttons_panel.add(self.save_button) self.enable_button = JButton('Enable', actionPerformed=self.enableGateway) self.buttons_panel.add(self.enable_button) self.disable_button = JButton('Disable', actionPerformed=self.disableGateway) self.buttons_panel.add(self.disable_button) self.disable_button.setEnabled(False) self.protocol_panel = JPanel() self.main.add(self.protocol_panel) self.protocol_panel.setLayout( BoxLayout(self.protocol_panel, BoxLayout.Y_AXIS)) self.protocol_panel.add(JLabel("Target Protocol:")) self.https_button = JRadioButton("HTTPS", True) self.http_button = JRadioButton("HTTP", False) self.protocol_panel.add(self.http_button) self.protocol_panel.add(self.https_button) buttongroup = ButtonGroup() buttongroup.add(self.https_button) buttongroup.add(self.http_button) self.regions_title = JPanel() self.main.add(self.regions_title) self.regions_title.add(JLabel("Regions to launch API Gateways in:")) self.regions_panel = JPanel() self.main.add(self.regions_panel) glayout = GridLayout(4, 3) self.regions_panel.setLayout(glayout) for region in AVAIL_REGIONS: cur_region = region.replace('-', '_') cur_region = cur_region + '_status' if cur_region.startswith( "ap") and cur_region != 'ap_east_1_status': setattr(self, cur_region, JCheckBox(region, True)) else: setattr(self, cur_region, JCheckBox(region, False)) attr = getattr(self, cur_region) self.regions_panel.add(attr) self.status = JPanel() self.main.add(self.status) self.status.setLayout(BoxLayout(self.status, BoxLayout.X_AXIS)) self.status_indicator = JLabel(DISABLED, JLabel.CENTER) self.status.add(self.status_indicator) self.panel.add(self.main) return self.panel
def getUiComponent(self): self.panel = JPanel() self.main = JPanel() self.main.setLayout(BoxLayout(self.main, BoxLayout.Y_AXIS)) self.access_key_panel = JPanel() self.main.add(self.access_key_panel) self.access_key_panel.setLayout( BoxLayout(self.access_key_panel, BoxLayout.X_AXIS)) self.access_key_panel.add(JLabel('Access Key: ')) self.access_key = JTextField('', 25) self.access_key_panel.add(self.access_key) self.secret_key_panel = JPanel() self.main.add(self.secret_key_panel) self.secret_key_panel.setLayout( BoxLayout(self.secret_key_panel, BoxLayout.X_AXIS)) self.secret_key_panel.add(JLabel('Secret Key: ')) self.secret_key = JPasswordField('', 25) self.secret_key_panel.add(self.secret_key) self.target_host_panel = JPanel() self.main.add(self.target_host_panel) self.target_host_panel.setLayout( BoxLayout(self.target_host_panel, BoxLayout.X_AXIS)) self.target_host_panel.add(JLabel('Target host: ')) self.target_host = JTextField('example.com', 25) self.target_host_panel.add(self.target_host) self.buttons_panel = JPanel() self.main.add(self.buttons_panel) self.buttons_panel.setLayout( BoxLayout(self.buttons_panel, BoxLayout.X_AXIS)) #self.save_button = JButton('Save', actionPerformed = self.saveKeys) #not implemented yet #self.buttons_panel.add(self.save_button) self.enable_button = JButton('Enable', actionPerformed=self.enableGateway) self.buttons_panel.add(self.enable_button) self.disable_button = JButton('Disable', actionPerformed=self.disableGateway) self.buttons_panel.add(self.disable_button) self.disable_button.setEnabled(False) self.protocol_panel = JPanel() self.main.add(self.protocol_panel) self.protocol_panel.setLayout( BoxLayout(self.protocol_panel, BoxLayout.Y_AXIS)) self.protocol_panel.add(JLabel("Target Protocol:")) self.https_button = JRadioButton("HTTPS", True) self.http_button = JRadioButton("HTTP", False) self.protocol_panel.add(self.http_button) self.protocol_panel.add(self.https_button) buttongroup = ButtonGroup() buttongroup.add(self.https_button) buttongroup.add(self.http_button) self.regions_title = JPanel() self.main.add(self.regions_title) self.regions_title.add(JLabel("Regions to launch API Gateways in:")) self.regions_panel = JPanel() self.main.add(self.regions_panel) glayout = GridLayout(4, 3) self.regions_panel.setLayout(glayout) for region in AVAIL_REGIONS: cur_region = region.replace('-', '_') cur_region = cur_region + '_status' setattr(self, cur_region, JCheckBox(region, True)) attr = getattr(self, cur_region) self.regions_panel.add(attr) self.status = JPanel() self.main.add(self.status) self.status.setLayout(BoxLayout(self.status, BoxLayout.X_AXIS)) self.status_indicator = JLabel(DISABLED, JLabel.CENTER) self.status.add(self.status_indicator) self.panel.add(self.main) return self.panel
class TimesketchSettingsWithUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI def __init__(self, settings): self.local_settings = settings self.tag_list = [] self.initComponents() self.customizeComponents() self.path_to_Timesketch_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Timesketch_api.exe") # Check to see if the Timesketch server is available and you can talk to it def Check_Server(self, e): pipe = Popen([self.path_to_Timesketch_exe, self.Protocol_TF.getText(),self.IP_Address_TF.getText(), self.Port_Number_TF.getText(), "Timesketch_status" ], stdout=PIPE, stderr=PIPE) out_text = pipe.communicate()[0] self.Error_Message.setText("Timesketch Status is " + out_text) #self.log(Level.INFO, "Timesketch Status is ==> " + out_text) def setIPAddress(self, event): self.local_settings.setSetting('ipAddress', self.IP_Address_TF.getText()) def setPortNumber(self, event): self.local_settings.setSetting('portNumber', self.Port_Number_TF.getText()) def setUserName(self, event): self.local_settings.setSetting('userName', self.userName_TF.getText()) def setPassword(self, event): self.local_settings.setSetting('password', self.password_TF.getText()) def setsketchName(self, event): self.local_settings.setSetting('sketchName', self.sketchName_TF.getText()) def setsketchDescription(self, event): self.local_settings.setSetting('sketchDescription', self.sketchDescription_TF.getText()) # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_2 = JLabel("Timesketch IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Label_4 = JLabel("User Name") self.Label_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_4, self.gbcPanel0 ) self.panel0.add( self.Label_4 ) self.userName_TF = JTextField(20, focusLost=self.setUserName) self.userName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.userName_TF, self.gbcPanel0 ) self.panel0.add( self.userName_TF ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_5 = JLabel("Password") self.Label_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_5, self.gbcPanel0 ) self.panel0.add( self.Label_5 ) self.password_TF = JPasswordField(20, focusLost=self.setPassword) # self.password_TF = JTextField(20) self.password_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.password_TF, self.gbcPanel0 ) self.panel0.add( self.password_TF ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_6 = JLabel("Sketch Name") self.Label_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_6, self.gbcPanel0 ) self.panel0.add( self.Label_6 ) self.sketchName_TF = JTextField(20, focusLost=self.setsketchName) self.sketchName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchName_TF, self.gbcPanel0 ) self.panel0.add( self.sketchName_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_7 = JLabel("Sketch Description") self.Label_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_7, self.gbcPanel0 ) self.panel0.add( self.Label_7 ) self.sketchDescription_TF = JTextField(20, focusLost=self.setsketchDescription) self.sketchDescription_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchDescription_TF, self.gbcPanel0 ) self.panel0.add( self.sketchDescription_TF ) self.Blank_7 = JLabel( " ") self.Blank_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_7, self.gbcPanel0 ) self.panel0.add( self.Blank_7 ) # self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) # self.Check_Server_Status_BTN.setEnabled(True) # self.rbgPanel0.add( self.Save_Settings_BTN ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) # self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): #self.Exclude_File_Sources_CB.setSelected(self.local_settings.getExclude_File_Sources()) #self.Run_Timesketch_CB.setSelected(self.local_settings.getRun_Timesketch()) #self.Import_Timesketch_CB.setSelected(self.local_settings.getImport_Timesketch()) #self.check_Database_entries() self.IP_Address_TF.setText(self.local_settings.getSetting('ipAddress')) self.Port_Number_TF.setText(self.local_settings.getSetting('portNumber')) self.userName_TF.setText(self.local_settings.getSetting('userName')) self.password_TF.setText(self.local_settings.getSetting('password')) self.sketchName_TF.setText(Case.getCurrentCase().getNumber()) self.sketchDescription_TF.setText(Case.getCurrentCase().getName()) self.local_settings.setSetting('sketchName', self.sketchName_TF.getText()) self.local_settings.setSetting('sketchDescription', self.sketchDescription_TF.getText()) # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_2 = JLabel("Timesketch IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Label_4 = JLabel("User Name") self.Label_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_4, self.gbcPanel0 ) self.panel0.add( self.Label_4 ) self.userName_TF = JTextField(20, focusLost=self.setUserName) self.userName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.userName_TF, self.gbcPanel0 ) self.panel0.add( self.userName_TF ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_5 = JLabel("Password") self.Label_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_5, self.gbcPanel0 ) self.panel0.add( self.Label_5 ) self.password_TF = JPasswordField(20, focusLost=self.setPassword) # self.password_TF = JTextField(20) self.password_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.password_TF, self.gbcPanel0 ) self.panel0.add( self.password_TF ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_6 = JLabel("Sketch Name") self.Label_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_6, self.gbcPanel0 ) self.panel0.add( self.Label_6 ) self.sketchName_TF = JTextField(20, focusLost=self.setsketchName) self.sketchName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchName_TF, self.gbcPanel0 ) self.panel0.add( self.sketchName_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_7 = JLabel("Sketch Description") self.Label_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_7, self.gbcPanel0 ) self.panel0.add( self.Label_7 ) self.sketchDescription_TF = JTextField(20, focusLost=self.setsketchDescription) self.sketchDescription_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchDescription_TF, self.gbcPanel0 ) self.panel0.add( self.sketchDescription_TF ) self.Blank_7 = JLabel( " ") self.Blank_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_7, self.gbcPanel0 ) self.panel0.add( self.Blank_7 ) # self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) # self.Check_Server_Status_BTN.setEnabled(True) # self.rbgPanel0.add( self.Save_Settings_BTN ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) # self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
def __init__(self, text, columns): '''Constructor''' JPasswordField.__init__(self, text, columns) self.focusGained=lambda e: e.getSource().selectAll() self.focusLost=lambda e: e.getSource().select(0,0)