public OpenKeystoreJPanel() { super(); labelKeystoreName = new JLabel(); labelKeystoreName.setText("Keystore File"); textKeystoreName = new CFJStringEditor(); textKeystoreName.setEditable(false); textKeystoreName.setEnabled(false); textKeystoreName.setMaxLen(4096); CFBamClientConfigurationFile configFile = swingSchema.getClientConfigurationFile(); String keystoreFileName = configFile.getKeyStore(); textKeystoreName.setText(keystoreFileName); labelKeystorePassword = new JLabel(); labelKeystorePassword.setText("Keystore Password"); textKeystorePassword = new JPasswordField(); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); add(labelKeystoreName); add(textKeystoreName); add(labelKeystorePassword); add(textKeystorePassword); add(buttonOk); add(buttonCancel); Dimension sz = new Dimension(800, 480); setSize(sz); int height = doLayoutRetHeight(); Dimension newSz = new Dimension(800, height); setSize(newSz); }
public int doLayoutRetHeight() { Dimension sz = getSize(); final int itemHeight = 25; final int itemSpacing = 5; final int labelWidth = 150; final int buttonHeight = 35; final int buttonWidth = 100; int y = itemSpacing; int fieldWidth = sz.width - (itemSpacing + labelWidth + itemSpacing + itemSpacing); int fieldX = itemSpacing + labelWidth + itemSpacing; int buttonSpacing = (sz.width - (buttonWidth + buttonWidth)) / 4; labelFileName.setBounds(itemSpacing, y, labelWidth, itemHeight); textFileName.setBounds(fieldX, y, fieldWidth, itemHeight); y = y + itemHeight + itemSpacing; labelLogContents.setBounds(itemSpacing, y, labelWidth, itemHeight); int logContentsHeight = sz.height - (y + buttonHeight + itemSpacing + itemSpacing); if (logContentsHeight < 100) { logContentsHeight = 100; } textLogContents.setBounds(fieldX, y, fieldWidth, logContentsHeight); y = y + logContentsHeight + itemSpacing + itemSpacing; buttonChooseFile.setBounds(buttonSpacing, y, buttonWidth, buttonHeight); buttonImportFile.setBounds( buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight); buttonClose.setBounds( buttonSpacing + buttonWidth + buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight); y = y + buttonHeight + itemSpacing + itemSpacing; return (y); }
public FileImportJPanel() { super(); labelFileName = new JLabel(); labelFileName.setText("Server URL"); labelFileName = new JLabel(); labelFileName.setText("File Name"); textFileName = new CFJStringEditor(); textFileName.setMaxLen(4096); labelLogContents = new JLabel(); labelLogContents.setText("Import Log Contents"); textLogContents = new CFJTextEditor(); textLogContents.setMaxLen(1000000); actionChooseFile = new ActionChooseFile(); actionImportFile = new ActionImportFile(); actionClose = new ActionClose(); buttonChooseFile = new JButton(actionChooseFile); buttonImportFile = new JButton(actionImportFile); buttonClose = new JButton(actionClose); add(labelFileName); add(textFileName); add(labelLogContents); add(textLogContents); add(buttonChooseFile); add(buttonImportFile); add(buttonClose); Dimension sz = new Dimension(800, 480); setSize(sz); int height = doLayoutRetHeight(); Dimension newSz = new Dimension(800, height); setSize(newSz); }
public int doLayoutRetHeight() { Dimension sz = getSize(); final int itemHeight = 25; final int itemSpacing = 5; final int labelWidth = 150; final int buttonHeight = 35; final int buttonWidth = 100; int y = itemSpacing; int fieldWidth = sz.width - (itemSpacing + labelWidth + itemSpacing + itemSpacing); int fieldX = itemSpacing + labelWidth + itemSpacing; int buttonSpacing = (sz.width - (buttonWidth + buttonWidth)) / 3; labelKeystoreName.setBounds(itemSpacing, y, labelWidth, itemHeight); textKeystoreName.setBounds(fieldX, y, fieldWidth, itemHeight); y = y + itemHeight + itemSpacing; labelKeystorePassword.setBounds(itemSpacing, y, labelWidth, itemHeight); textKeystorePassword.setBounds(fieldX, y, fieldWidth, itemHeight); y = y + itemHeight + itemSpacing + itemSpacing; buttonOk.setBounds(buttonSpacing, y, buttonWidth, buttonHeight); buttonCancel.setBounds( buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight); y = y + buttonHeight + itemSpacing + itemSpacing; return (y); }