List of usage examples for javax.swing JPanel requestFocus
public void requestFocus()
Component
gets the input focus. From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java
/** * This method initializes jPanel//from w w w . j a v a2 s. co m * * @return javax.swing.JPanel */ private JPanel getJTabbed() { if (jPanel == null) { /* jPanel = new JPanel(); jPanel.setPreferredSize(new java.awt.Dimension(800,600)); jPanel.setLayout(new GridBagLayout()); */ // jPanel is the outside one jPanel = new JPanel(); jPanel.setPreferredSize(new java.awt.Dimension(800, 600)); jPanel.setLayout(new GridBagLayout()); jTabbed = new JTabbedPane(); jTabbed.setPreferredSize(new java.awt.Dimension(800, 500)); final JPanel jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); final JPanel jPanel2 = new JPanel(); //jPanel2.setPreferredSize(new java.awt.Dimension(800,500)); jPanel2.setLayout(new GridBagLayout()); final JPanel jPanel3 = new JPanel(); //jPanel3.setPreferredSize(new java.awt.Dimension(800,500)); jPanel3.setLayout(new GridBagLayout()); final JPanel jPanel4 = new JPanel(); jPanel4.setLayout(new GridBagLayout()); // 3 tabs - Encode, Decode, Hash?? addField(jPanel1, 1, getBase64EncodeField(), Constant.messages.getString("enc2.label.b64Enc")); addField(jPanel1, 2, getUrlEncodeField(), Constant.messages.getString("enc2.label.urlEnc")); addField(jPanel1, 3, getAsciiHexEncodeField(), Constant.messages.getString("enc2.label.asciiEnc")); addField(jPanel1, 4, getHTMLEncodeField(), Constant.messages.getString("enc2.label.HTMLEnc")); addField(jPanel1, 5, getJavaScriptEncodeField(), Constant.messages.getString("enc2.label.JavaScriptEnc")); addField(jPanel2, 1, getBase64DecodeField(), Constant.messages.getString("enc2.label.b64Dec")); addField(jPanel2, 2, getUrlDecodeField(), Constant.messages.getString("enc2.label.urlDec")); addField(jPanel2, 3, getAsciiHexDecodeField(), Constant.messages.getString("enc2.label.asciiDec")); addField(jPanel2, 4, getHTMLDecodeField(), Constant.messages.getString("enc2.label.HTMLDec")); addField(jPanel2, 5, getJavaScriptDecodeField(), Constant.messages.getString("enc2.label.JavaScriptDec")); addField(jPanel3, 1, getSha1HashField(), Constant.messages.getString("enc2.label.sha1Hash")); addField(jPanel3, 2, getMd5HashField(), Constant.messages.getString("enc2.label.md5Hash")); addField(jPanel4, 1, getIllegalUTF82ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.2byte")); addField(jPanel4, 2, getIllegalUTF83ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.3byte")); addField(jPanel4, 3, getIllegalUTF84ByteField(), Constant.messages.getString("enc2.label.illegalUTF8.4byte")); jTabbed.addTab(Constant.messages.getString("enc2.tab.encode"), jPanel1); jTabbed.addTab(Constant.messages.getString("enc2.tab.decode"), jPanel2); jTabbed.addTab(Constant.messages.getString("enc2.tab.hash"), jPanel3); jTabbed.addTab(Constant.messages.getString("enc2.tab.illegalUTF8"), jPanel4); final java.awt.GridBagConstraints gbc1 = new GridBagConstraints(); gbc1.gridx = 0; gbc1.gridy = 1; gbc1.insets = new java.awt.Insets(1, 1, 1, 1); gbc1.anchor = java.awt.GridBagConstraints.NORTHWEST; gbc1.fill = java.awt.GridBagConstraints.BOTH; gbc1.weightx = 1.0D; gbc1.weighty = 0.25D; final java.awt.GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.gridx = 0; gbc2.gridy = 2; gbc2.insets = new java.awt.Insets(1, 1, 1, 1); gbc2.anchor = java.awt.GridBagConstraints.NORTHWEST; gbc2.fill = java.awt.GridBagConstraints.BOTH; gbc2.weightx = 1.0D; gbc2.weighty = 1.0D; final JScrollPane jsp = new JScrollPane(); jsp.setViewportView(getInputField()); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBorder(BorderFactory.createTitledBorder(null, Constant.messages.getString("enc2.label.text"), TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, FontUtils.getFont(FontUtils.Size.standard), java.awt.Color.black)); //addField(jPanel, 1, getInputField(), "Text to be encoded/decoded/hashed"); //addField(jPanel, 2, jTabbed, "Text to be encoded/decoded/hashed"); jPanel.add(jsp, gbc1); jPanel.add(jTabbed, gbc2); jPanel2.requestFocus(); } return jPanel; }