public void showItem() { if (!this.editorPanel.getViewer().isLanguageFunctionAvailable()) { return; } this.highlight = this.editorPanel .getEditor() .addHighlight(this.position, this.position + this.word.length(), null, true); final FindSynonymsActionHandler _this = this; QTextEditor editor = this.editorPanel.getEditor(); Rectangle r = null; try { r = editor.modelToView(this.position); } catch (Exception e) { // BadLocationException! Environment.logError("Location: " + this.position + " is not valid", e); UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms."); return; } int y = r.y; // Show a panel of all the items. final QPopup p = this.popup; p.setOpaque(false); Synonyms syns = null; try { syns = this.projectViewer.getSynonymProvider().getSynonyms(this.word); } catch (Exception e) { UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms."); Environment.logError("Unable to lookup synonyms for: " + word, e); return; } if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("ed"))) { // Trim off the ed and try again. try { syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 2)); } catch (Exception e) { UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms."); Environment.logError("Unable to lookup synonyms for: " + word, e); return; } } if ((syns.words.size() == 0) && (this.word.toLowerCase().endsWith("s"))) { // Trim off the ed and try again. try { syns = this.projectViewer.getSynonyms(this.word.substring(0, this.word.length() - 1)); } catch (Exception e) { UIUtils.showErrorMessage(this.editorPanel, "Unable to display synonyms."); Environment.logError("Unable to lookup synonyms for: " + word, e); return; } } StringBuilder sb = new StringBuilder(); if (syns.words.size() > 0) { sb.append("6px"); for (int i = 0; i < syns.words.size(); i++) { if (sb.length() > 0) { sb.append(", "); } sb.append("p, 3px, [p,90px], 5px"); } /* if (syns.words.size () > 0) { sb.append (",5px"); } */ } else { sb.append("6px, p, 6px"); } FormLayout summOnly = new FormLayout("3px, fill:380px:grow, 3px", sb.toString()); PanelBuilder pb = new PanelBuilder(summOnly); CellConstraints cc = new CellConstraints(); int ind = 2; Map<String, String> names = new HashMap(); names.put(Synonyms.ADJECTIVE + "", "Adjectives"); names.put(Synonyms.NOUN + "", "Nouns"); names.put(Synonyms.VERB + "", "Verbs"); names.put(Synonyms.ADVERB + "", "Adverbs"); names.put(Synonyms.OTHER + "", "Other"); if (syns.words.size() == 0) { JLabel l = new JLabel("No synonyms found."); l.setFont(l.getFont().deriveFont(Font.ITALIC)); pb.add(l, cc.xy(2, 2)); } // Determine what type of word we are looking for. for (Synonyms.Part i : syns.words) { JLabel l = new JLabel(names.get(i.type + "")); l.setFont(l.getFont().deriveFont(Font.ITALIC)); l.setFont(l.getFont().deriveFont((float) UIUtils.getEditorFontSize(10))); l.setBorder( new CompoundBorder( new MatteBorder(0, 0, 1, 0, Environment.getBorderColor()), new EmptyBorder(0, 0, 3, 0))); pb.add(l, cc.xy(2, ind)); ind += 2; HTMLEditorKit kit = new HTMLEditorKit(); HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); JTextPane t = new JTextPane(doc); t.setEditorKit(kit); t.setEditable(false); t.setOpaque(false); StringBuilder buf = new StringBuilder( "<style>a { text-decoration: none; } a:hover { text-decoration: underline; }</style><span style='color: #000000; font-size: " + ((int) UIUtils.getEditorFontSize(10) /*t.getFont ().getSize () + 2*/) + "pt; font-family: " + t.getFont().getFontName() + ";'>"); for (int x = 0; x < i.words.size(); x++) { String w = (String) i.words.get(x); buf.append("<a class='x' href='http://" + w + "'>" + w + "</a>"); if (x < (i.words.size() - 1)) { buf.append(", "); } } buf.append("</span>"); t.setText(buf.toString()); t.addHyperlinkListener( new HyperlinkAdapter() { public void hyperlinkUpdate(HyperlinkEvent ev) { if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { QTextEditor ed = _this.editorPanel.getEditor(); ed.replaceText( _this.position, _this.position + _this.word.length(), ev.getURL().getHost()); ed.removeHighlight(_this.highlight); _this.popup.setVisible(false); _this.projectViewer.fireProjectEvent( ProjectEvent.SYNONYM, ProjectEvent.REPLACE, ev.getURL().getHost()); } } }); // Annoying that we have to do this but it prevents the text from being too small. t.setSize(new Dimension(380, Short.MAX_VALUE)); JScrollPane sp = new JScrollPane(t); t.setCaretPosition(0); sp.setOpaque(false); sp.getVerticalScrollBar().setValue(0); /* sp.setPreferredSize (t.getPreferredSize ()); sp.setMaximumSize (new Dimension (380, 75)); */ sp.getViewport().setOpaque(false); sp.setOpaque(false); sp.setBorder(null); sp.getViewport().setBackground(Color.WHITE); sp.setAlignmentX(Component.LEFT_ALIGNMENT); pb.add(sp, cc.xy(2, ind)); ind += 2; } JPanel pan = pb.getPanel(); pan.setOpaque(true); pan.setBackground(Color.WHITE); this.popup.setContent(pan); // r.y -= this.editorPanel.getScrollPane ().getVerticalScrollBar ().getValue (); Point po = SwingUtilities.convertPoint(editor, r.x, r.y, this.editorPanel); r.x = po.x; r.y = po.y; // Subtract the insets of the editorPanel. Insets ins = this.editorPanel.getInsets(); r.x -= ins.left; r.y -= ins.top; this.editorPanel.showPopupAt(this.popup, r, "above", true); }
private static int getScrollPaneBaseline(JScrollPane sp, int height) { Component view = sp.getViewport().getView(); if (view instanceof JComponent) { int baseline = getBaseline((JComponent) view); if (baseline > 0) { return baseline + sp.getViewport().getY(); } } return -1; }
/** {@inheritDoc} */ @Override protected void installListeners(JScrollPane c) { super.installListeners(c); c.addPropertyChangeListener(this); if (UIManager.getBoolean("ScrollPane.useChildTextComponentFocus")) { viewportViewFocusHandler = new ViewportViewFocusHandler(); c.getViewport().addContainerListener(viewportViewFocusHandler); Component view = c.getViewport().getView(); if (view instanceof JTextComponent) { view.addFocusListener(viewportViewFocusHandler); } } }
private void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20); contentPane.setBorder(border1); contentPane.setLayout(borderLayout1); controlsPane.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setHgap(10); gridLayout1.setRows(0); gridLayout1.setVgap(10); okButton.setVerifyInputWhenFocusTarget(true); okButton.setMnemonic('O'); okButton.setText("OK"); buttonsPane.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.CENTER); messagePane.setEditable(false); messagePane.setText(""); borderLayout1.setHgap(10); borderLayout1.setVgap(10); this.setTitle("Subscription Authorization"); this.getContentPane().add(contentPane, BorderLayout.CENTER); contentPane.add(controlsPane, BorderLayout.SOUTH); controlsPane.add(responsesComboBox, null); controlsPane.add(buttonsPane, null); buttonsPane.add(okButton, null); contentPane.add(messageScrollPane, BorderLayout.CENTER); messageScrollPane.getViewport().add(messagePane, null); }
/** @param frameName title name for frame */ public ShowSavedResults(String frameName) { super(frameName); aboutRes = new JTextArea( "Select a result set from" + "\nthose listed and details" + "\nof that analysis will be" + "\nshown here. Then you can" + "\neither delete or view those" + "\nresults using the buttons below."); aboutScroll = new JScrollPane(aboutRes); ss = new JScrollPane(sp); ss.getViewport().setBackground(Color.white); // resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1)); ClassLoader cl = getClass().getClassLoader(); rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif")); // results status resButtonStatus = new JPanel(new BorderLayout()); Border loweredbevel = BorderFactory.createLoweredBevelBorder(); Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel); statusField = new JTextField(); statusField.setBorder(compound); statusField.setEditable(false); }
private void ensureRowIsVisible(int nRow) { Rectangle visibleRect = table.getCellRect(nRow, 0, true); if (debugSetPath) System.out.println("----ensureRowIsVisible = " + visibleRect); if (visibleRect != null) { visibleRect.x = scrollPane.getViewport().getViewPosition().x; table.scrollRectToVisible(visibleRect); table.repaint(); } }
/** * Set the view of the scrollable picture to show the map location * * @param mapLocation "(x, y)" */ public void setView(String mapLocation) { int x = Integer.parseInt(mapLocation.substring(1, mapLocation.indexOf(','))); int y = Integer.parseInt( mapLocation.substring(mapLocation.indexOf(", ") + 2, mapLocation.length() - 1)); Point point = new Point(x - (mapScrollPane.getWidth() / 2), y - (mapScrollPane.getHeight() / 2)); map.showLocation(true, x, y); mapScrollPane.getViewport().setViewPosition(point); }
private void jbInit() throws Exception { titledBorder1 = new TitledBorder(""); this.setLayout(borderLayout1); this.setBorder(titledBorder1); titledBorder1.setTitleColor(Color.blue); titledBorder1.setTitle( ClientSettings.getInstance().getResources().getResource("documents filter")); this.add(sp, BorderLayout.CENTER); sp.setBorder(BorderFactory.createEmptyBorder()); sp.getViewport().add(innerPanel, null); sp.setAutoscrolls(true); innerPanel.setLayout(gridBagLayout1); }
/** * Method to check that the current position is in the viewing area and if not scroll to center * the current position if possible */ public void checkScroll() { // get the x and y position in pixels int xPos = (int) (colIndex * zoomFactor); int yPos = (int) (rowIndex * zoomFactor); // only do this if the image is larger than normal if (zoomFactor > 1) { // get the rectangle that defines the current view JViewport viewport = scrollPane.getViewport(); Rectangle rect = viewport.getViewRect(); int rectMinX = (int) rect.getX(); int rectWidth = (int) rect.getWidth(); int rectMaxX = rectMinX + rectWidth - 1; int rectMinY = (int) rect.getY(); int rectHeight = (int) rect.getHeight(); int rectMaxY = rectMinY + rectHeight - 1; // get the maximum possible x and y index int macolIndexX = (int) (picture.getWidth() * zoomFactor) - rectWidth - 1; int macolIndexY = (int) (picture.getHeight() * zoomFactor) - rectHeight - 1; // calculate how to position the current position in the middle of the viewing // area int viewX = xPos - (int) (rectWidth / 2); int viewY = yPos - (int) (rectHeight / 2); // reposition the viewX and viewY if outside allowed values if (viewX < 0) viewX = 0; else if (viewX > macolIndexX) viewX = macolIndexX; if (viewY < 0) viewY = 0; else if (viewY > macolIndexY) viewY = macolIndexY; // move the viewport upper left point viewport.scrollRectToVisible(new Rectangle(viewX, viewY, rectWidth, rectHeight)); } }
private void jbInit() throws Exception { titledBorder1 = new TitledBorder(""); this.setLayout(baseLayout); double[][] lower_size = { {TableLayout.PREFERRED, TableLayout.FILL, 25}, {25, 25, TableLayout.FILL} }; mLowerPanelLayout = new TableLayout(lower_size); mLowerPanel.setLayout(mLowerPanelLayout); double[][] dir_size = { {TableLayout.FILL, TableLayout.PREFERRED}, {TableLayout.PREFERRED, TableLayout.FILL} }; mDirectionsPanelLayout = new TableLayout(dir_size); mDirectionsPanel.setLayout(mDirectionsPanelLayout); // Try to get icons for the toolbar buttons try { ClassLoader loader = getClass().getClassLoader(); mAddIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/add.gif")); mRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove.gif")); mDisabledRemoveIcon = new ImageIcon(loader.getResource(COMMON_IMG_ROOT + "/remove_disabled.gif")); mAddNodeBtn.setIcon(mAddIcon); mRemoveNodeBtn.setIcon(mRemoveIcon); mRemoveNodeBtn.setDisabledIcon(mDisabledRemoveIcon); } catch (Exception e) { // Ack! No icons. Use text labels instead mAddNodeBtn.setText("Add"); mRemoveNodeBtn.setText("Remove"); } /* mAddNodeBtn.setMaximumSize(new Dimension(130, 33)); mAddNodeBtn.setMinimumSize(new Dimension(130, 33)); mAddNodeBtn.setPreferredSize(new Dimension(130, 33)); mAddNodeBtn.setText("Add Node"); */ mAddNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); /* mRemoveNodeBtn.setMaximumSize(new Dimension(130, 33)); mRemoveNodeBtn.setMinimumSize(new Dimension(130, 33)); mRemoveNodeBtn.setPreferredSize(new Dimension(130, 33)); mRemoveNodeBtn.setText("Remove Node"); */ mRemoveNodeBtn.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mRemoveNode(); } }); mHostnameLabel.setHorizontalAlignment(SwingConstants.TRAILING); mHostnameLabel.setLabelFor(mHostnameField); mHostnameLabel.setText("Hostname:"); mHostnameField.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { mAddNodeBtn_actionPerformed(e); } }); mDirectionsPanel.setBorder(BorderFactory.createEtchedBorder()); mTitleLabel.setFont(new java.awt.Font("Serif", 1, 20)); mTitleLabel.setHorizontalAlignment(SwingConstants.CENTER); mTitleLabel.setText("Add Cluster Nodes"); mDirectionsLabel.setText("Click on the add button to add nodes to your cluster configuration."); mDirectionsLabel.setLineWrap(true); mDirectionsLabel.setEditable(false); mDirectionsLabel.setBackground(mTitleLabel.getBackground()); baseLayout.setHgap(5); baseLayout.setVgap(5); mLowerPanel.add( mHostnameLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mHostnameField, new TableLayoutConstraints(1, 0, 1, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mListScrollPane1, new TableLayoutConstraints(0, 1, 1, 2, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mAddNodeBtn, new TableLayoutConstraints(2, 0, 2, 0, TableLayout.FULL, TableLayout.FULL)); mLowerPanel.add( mRemoveNodeBtn, new TableLayoutConstraints(2, 1, 2, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mLowerPanel, BorderLayout.CENTER); mListScrollPane1.getViewport().add(lstNodes, null); mDirectionsPanel.add( mTitleLabel, new TableLayoutConstraints(0, 0, 0, 0, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mDirectionsLabel, new TableLayoutConstraints(0, 1, 0, 1, TableLayout.FULL, TableLayout.FULL)); mDirectionsPanel.add( mIconLabel, new TableLayoutConstraints(1, 0, 1, 1, TableLayout.FULL, TableLayout.FULL)); this.add(mDirectionsPanel, BorderLayout.NORTH); }
void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(10, 10, 5, 5); panel1.setLayout(borderLayout1); jPanel1.setLayout(borderLayout2); jScrollPane1.getViewport().setBackground(Color.white); jPanel2.setLayout(gridBagLayout1); jLabel1.setText("Profile Name : "); nameTextField.setMinimumSize(new Dimension(4, 18)); nameTextField.setPreferredSize(new Dimension(63, 18)); jLabel2.setText("Profile Type : "); openButton.setMaximumSize(new Dimension(73, 24)); openButton.setMinimumSize(new Dimension(73, 24)); openButton.setPreferredSize(new Dimension(73, 24)); openButton.setText("Open"); openButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { openButton_actionPerformed(e); } }); cancelButton.setMaximumSize(new Dimension(73, 24)); cancelButton.setMinimumSize(new Dimension(73, 24)); cancelButton.setPreferredSize(new Dimension(73, 24)); cancelButton.setMargin(new Insets(0, 5, 0, 5)); cancelButton.setText("Cancel"); cancelButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { cancelButton_actionPerformed(e); } }); profileList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); profileList.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { profileList_mouseClicked(e); } }); jPanel2.setBorder(border1); typeComboBox.setMaximumSize(new Dimension(32767, 18)); typeComboBox.setMinimumSize(new Dimension(122, 18)); typeComboBox.setPreferredSize(new Dimension(176, 18)); getContentPane().add(panel1); panel1.add(jPanel1, BorderLayout.CENTER); jPanel1.add(jScrollPane1, BorderLayout.CENTER); panel1.add(jPanel2, BorderLayout.SOUTH); jPanel2.add( jLabel1, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 7, 0), 0, 0)); jPanel2.add( nameTextField, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 11, 7, 0), 0, 0)); jPanel2.add( jLabel2, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 17, 0), 0, 0)); jScrollPane1.getViewport().add(profileList, null); jPanel2.add( openButton, new GridBagConstraints( 3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 11, 2, 10), 0, 0)); jPanel2.add( cancelButton, new GridBagConstraints( 3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 11, 9, 10), 0, 0)); jPanel2.add( typeComboBox, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 11, 17, 0), 0, 0)); }
private void jbInit() throws Exception { border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border2 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border3 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder1 = new TitledBorder(border3, "Subject"); border4 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder2 = new TitledBorder(border4, "Message"); border5 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder3 = new TitledBorder(border5, "Subject"); border6 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder4 = new TitledBorder(border6, "Message"); border7 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder5 = new TitledBorder(border7, "Messages"); border8 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder6 = new TitledBorder(border8, "Online Users"); border9 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder7 = new TitledBorder(border9, "Send Message"); this.getContentPane().setLayout(borderLayout1); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane1.setBorder(border1); jSplitPane1.setLastDividerLocation(250); jSplitPane1.setResizeWeight(1.0); jLabelServer.setRequestFocusEnabled(true); jLabelServer.setText("Server"); jLabelUserId.setText("User Id"); jTextFieldServer.setPreferredSize(new Dimension(75, 20)); jTextFieldServer.setText(""); jTextFieldUser.setPreferredSize(new Dimension(75, 20)); jTextFieldUser.setText(""); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setJMenuBar(jMenuBarMain); this.setTitle("Message Client"); jLabeltargetUser.setText("Target"); jTextFieldTargetUser.setPreferredSize(new Dimension(75, 20)); jTextFieldTargetUser.setText(""); jPanelSendMessages.setBorder(border2); jPanelSendMessages.setMaximumSize(new Dimension(32767, 32767)); jPanelSendMessages.setOpaque(false); jPanelSendMessages.setPreferredSize(new Dimension(96, 107)); jPanelSendMessages.setRequestFocusEnabled(true); jPanelSendMessages.setToolTipText(""); jPanelSendMessages.setLayout(verticalFlowLayout1); jTextFieldSendSubject.setBorder(titledBorder3); jTextFieldSendSubject.setText(""); jTextFieldSendSubject.addKeyListener(new Client_jTextFieldSendSubject_keyAdapter(this)); jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT); jScrollPane1.setBorder(titledBorder5); jScrollPane2.setBorder(titledBorder6); jToggleButtonRegister.setText("Register"); jToggleButtonRegister.addActionListener(new Client_jToggleButtonRegister_actionAdapter(this)); jButtonMultiConnect.setText("Multi-Connect"); jButtonMultiConnect.addActionListener(new Client_jButtonMultiConnect_actionAdapter(this)); jListOnlineUsers.addMouseListener(new Client_jListOnlineUsers_mouseAdapter(this)); jToggleButtonConnect.setText("Connect"); jToggleButtonConnect.addActionListener(new Client_jToggleButtonConnect_actionAdapter(this)); jTextPaneDisplayMessages.setEditable(false); jTextPaneDisplayMessages.addMouseListener( new Client_jTextPaneDisplayMessages_mouseAdapter(this)); jTextFieldSendMessages.setBorder(titledBorder7); jTextFieldSendMessages.setToolTipText(""); jTextFieldSendMessages.addKeyListener(new Client_jTextFieldSendMessages_keyAdapter(this)); jButtonMessageStresser.setText("Msg Stresser"); jButtonMessageStresser.addActionListener( new Client_jToggleButtonMessageStresser_actionAdapter(this)); jMenuItemClearMessages.setText("Clear Messages"); jMenuItemClearMessages.addActionListener(new Client_jMenuItemClearMessages_actionAdapter(this)); jMenuServer.setText("Server"); jMenuItemServerConnect.setText("Connect"); jMenuItemServerConnect.addActionListener(new Client_jMenuItemServerConnect_actionAdapter(this)); jMenuItemServerDisconnect.setText("Disconnect"); jMenuItemServerDisconnect.addActionListener( new Client_jMenuItemServerDisconnect_actionAdapter(this)); jMenuOptions.setText("Options"); jMenuTest.setText("Test"); jMenuItemOptionsRegister.setText("Register"); jMenuItemOptionsRegister.addActionListener( new Client_jMenuItemOptionsRegister_actionAdapter(this)); jMenuItemOptionsDeregister.setText("Deregister"); jMenuItemOptionsDeregister.addActionListener( new Client_jMenuItemOptionsDeregister_actionAdapter(this)); jMenuItemOptionsEavesdrop.setText("Eavesdrop"); jMenuItemOptionsEavesdrop.addActionListener( new Client_jMenuItemOptionsEavesdrop_actionAdapter(this)); jMenuItemOptionsUneavesdrop.setText("Uneavesdrop"); jMenuItemOptionsUneavesdrop.addActionListener( new Client_jMenuItemOptionsUneavesdrop_actionAdapter(this)); jMenuItemTestMulticonnect.setText("Multiconnect"); jMenuItemTestMulticonnect.addActionListener( new Client_jMenuItemTestMulticonnect_actionAdapter(this)); jMenuItemTestMessageStresser.setText("Message Stresser"); jMenuItemTestMessageStresser.addActionListener( new Client_jMenuItemTestMessageStresser_actionAdapter(this)); jMenuItemTestMultidisconnect.setText("Multidisconnect"); jMenuItemTestMultidisconnect.addActionListener( new Client_jMenuItemTestMultidisconnect_actionAdapter(this)); jMenuItemOptionsGlobalEavesdrop.setText("Global Eavesdrop"); jMenuItemOptionsGlobalEavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalEavesdrop_actionAdapter(this)); jMenuItemOptionsGlobalUneavesdrop.setEnabled(false); jMenuItemOptionsGlobalUneavesdrop.setText("Global Uneavesdrop"); jMenuItemOptionsGlobalUneavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalUneavesdrop_actionAdapter(this)); jLabelPwd.setText("Pwd"); jPasswordFieldPwd.setMinimumSize(new Dimension(11, 20)); jPasswordFieldPwd.setPreferredSize(new Dimension(75, 20)); jPasswordFieldPwd.setText(""); jMenuItemScheduleCommand.setText("Schedule Command"); jMenuItemScheduleCommand.addActionListener( new Client_jMenuItemScheduleCommand_actionAdapter(this)); jMenuItemEditScheduledCommands.setText("Edit Scheduled Commands"); jMenuItemEditScheduledCommands.addActionListener( new Client_jMenuItemEditScheduledCommands_actionAdapter(this)); jPanelSendMessages.add(jTextFieldSendSubject, null); jPanelSendMessages.add(jTextFieldSendMessages, null); jSplitPane1.add(jSplitPane2, JSplitPane.TOP); jSplitPane2.add(jScrollPane1, JSplitPane.TOP); jScrollPane1.getViewport().add(jTextPaneDisplayMessages, null); jSplitPane2.add(jScrollPane2, JSplitPane.BOTTOM); jScrollPane2.getViewport().add(jListOnlineUsers, null); this.getContentPane().add(jSplitPane1, BorderLayout.CENTER); jSplitPane1.add(jPanelSendMessages, JSplitPane.BOTTOM); this.getContentPane().add(jPanel1, BorderLayout.NORTH); jPanel1.add(jLabelServer, null); jPanel1.add(jTextFieldServer, null); jPanel1.add(jLabelUserId, null); jPanel1.add(jTextFieldUser, null); jPanel1.add(jLabelPwd, null); jPanel1.add(jPasswordFieldPwd, null); jPanel1.add(jLabeltargetUser, null); jPanel1.add(jTextFieldTargetUser, null); jPanel1.add(jToggleButtonConnect, null); jPanel1.add(jToggleButtonRegister, null); jPanel1.add(jButtonMultiConnect, null); jPanel1.add(jButtonMessageStresser, null); jPopupMenuMessageArea.add(jMenuItemClearMessages); jMenuBarMain.add(jMenuServer); jMenuBarMain.add(jMenuOptions); jMenuBarMain.add(jMenuTest); jMenuServer.add(jMenuItemServerConnect); jMenuServer.add(jMenuItemServerDisconnect); jMenuOptions.add(jMenuItemOptionsRegister); jMenuOptions.add(jMenuItemOptionsDeregister); jMenuOptions.add(jMenuItemOptionsEavesdrop); jMenuOptions.add(jMenuItemOptionsUneavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalEavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalUneavesdrop); jMenuTest.add(jMenuItemTestMulticonnect); jMenuTest.add(jMenuItemTestMultidisconnect); jMenuTest.add(jMenuItemTestMessageStresser); jMenuTest.add(jMenuItemScheduleCommand); jMenuTest.add(jMenuItemEditScheduledCommands); jSplitPane1.setDividerLocation(200); jSplitPane2.setDividerLocation(600); jListOnlineUsers.setCellRenderer(new OnlineListCellRenderer()); jListOnlineUsers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); jMenuItemTestMulticonnect.setEnabled(true); jMenuItemTestMultidisconnect.setEnabled(false); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); jMenuItemOptionsRegister.setEnabled(true); jMenuItemOptionsDeregister.setEnabled(false); }
private void jbInit() throws Exception { this.getContentPane().setLayout(gridBagLayout2); bottomPanel.setLayout(gridBagLayout1); messagePanel.setBorder(BorderFactory.createLoweredBevelBorder()); replaceButton.setToolTipText("Save the new trace replacing the old trace."); replaceButton.setText("Replace old trace"); replaceButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { replaceOldTrace(); } }); buttonPanel.setBorder(BorderFactory.createLoweredBevelBorder()); discardButton.setToolTipText("Discard the new trace"); discardButton.setText("Discard new trace"); discardButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { DoneReplayDialog.this.setVisible(false); } }); saveButton.setToolTipText("Save the new trace in a file."); saveButton.setText("Save as new file"); saveButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { saveNewToFile(); } }); this.setModal(true); this.setTitle("Replay Complete"); jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jScrollPane1.setMinimumSize(new Dimension(200, 200)); jScrollPane1.setPreferredSize(new Dimension(200, 200)); jTextPane.setMinimumSize(new Dimension(25, 80)); jTextPane.setPreferredSize(new Dimension(40, 80)); tracePanel.setLayout(borderLayout1); commentPanel.setLayout(borderLayout3); jPanel6.setLayout(borderLayout2); jScrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jScrollPane2.setMinimumSize(new Dimension(200, 100)); jScrollPane2.setPreferredSize(new Dimension(200, 100)); jLabel1.setText("Comment"); jLabel2.setText("Traces (Old is Yellow, New is Pink)"); tracePanel.setBorder(BorderFactory.createEtchedBorder()); bottomPanel.setBorder(BorderFactory.createEtchedBorder()); commentPanel.setBorder(BorderFactory.createEtchedBorder()); this.getContentPane() .add( bottomPanel, new GridBagConstraints( 0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); buttonPanel.add(saveButton, null); buttonPanel.add(replaceButton, null); buttonPanel.add(discardButton, null); bottomPanel.add( messagePanel, new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); messagePanel.add(messageLabel, null); this.getContentPane() .add( tracePanel, new GridBagConstraints( 0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tracePanel.add(jScrollPane1, BorderLayout.CENTER); tracePanel.add(jLabel2, BorderLayout.NORTH); this.getContentPane() .add( commentPanel, new GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); commentPanel.add(jPanel6, BorderLayout.CENTER); jPanel6.add(jScrollPane2, BorderLayout.CENTER); commentPanel.add(jLabel1, BorderLayout.NORTH); jScrollPane2.getViewport().add(commentPane, null); jScrollPane1.getViewport().add(jTextPane, null); bottomPanel.add( buttonPanel, new GridBagConstraints( 0, 1, 2, 2, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); }
private void jbInit() throws Exception { saveButton.setText("Save"); saveButton.addActionListener(new PrintfTemplateEditor_saveButton_actionAdapter(this)); cancelButton.setText("Cancel"); cancelButton.addActionListener(new PrintfTemplateEditor_cancelButton_actionAdapter(this)); this.setTitle(this.getTitle() + " Template Editor"); printfPanel.setLayout(gridBagLayout1); formatLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); formatLabel.setText("Format String:"); buttonPanel.setLayout(flowLayout1); printfPanel.setBorder(BorderFactory.createEtchedBorder()); printfPanel.setMinimumSize(new Dimension(100, 160)); printfPanel.setPreferredSize(new Dimension(380, 160)); parameterPanel.setLayout(gridBagLayout2); parameterLabel.setText("Parameters:"); parameterLabel.setFont(new java.awt.Font("DialogInput", 0, 12)); parameterTextArea.setMinimumSize(new Dimension(100, 25)); parameterTextArea.setPreferredSize(new Dimension(200, 25)); parameterTextArea.setEditable(true); parameterTextArea.setText(""); insertButton.setMaximumSize(new Dimension(136, 20)); insertButton.setMinimumSize(new Dimension(136, 20)); insertButton.setPreferredSize(new Dimension(136, 20)); insertButton.setToolTipText( "insert the format in the format string and add parameter to list."); insertButton.setText("Insert Parameter"); insertButton.addActionListener(new PrintfTemplateEditor_insertButton_actionAdapter(this)); formatTextArea.setMinimumSize(new Dimension(100, 25)); formatTextArea.setPreferredSize(new Dimension(200, 15)); formatTextArea.setText(""); parameterPanel.setBorder(null); parameterPanel.setMinimumSize(new Dimension(60, 40)); parameterPanel.setPreferredSize(new Dimension(300, 40)); insertMatchButton.addActionListener( new PrintfTemplateEditor_insertMatchButton_actionAdapter(this)); insertMatchButton.setText("Insert Match"); insertMatchButton.setToolTipText( "insert the match in the format string and add parameter to list."); insertMatchButton.setPreferredSize(new Dimension(136, 20)); insertMatchButton.setMinimumSize(new Dimension(136, 20)); insertMatchButton.setMaximumSize(new Dimension(136, 20)); matchPanel.setPreferredSize(new Dimension(300, 40)); matchPanel.setBorder(null); matchPanel.setMinimumSize(new Dimension(60, 60)); matchPanel.setLayout(gridBagLayout3); InsertPanel.setLayout(gridLayout1); gridLayout1.setColumns(1); gridLayout1.setRows(2); gridLayout1.setVgap(0); InsertPanel.setBorder(BorderFactory.createEtchedBorder()); InsertPanel.setMinimumSize(new Dimension(100, 100)); InsertPanel.setPreferredSize(new Dimension(380, 120)); editorPane.setText(""); editorPane.addKeyListener(new PrintfEditor_editorPane_keyAdapter(this)); printfTabPane.addChangeListener(new PrintfEditor_printfTabPane_changeAdapter(this)); parameterPanel.add( insertButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); parameterPanel.add( paramComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); paramComboBox.setRenderer(new MyCellRenderer()); InsertPanel.add(matchPanel, null); InsertPanel.add(parameterPanel, null); buttonPanel.add(cancelButton, null); buttonPanel.add(saveButton, null); this.getContentPane().add(printfTabPane, BorderLayout.NORTH); this.getContentPane().add(InsertPanel, BorderLayout.CENTER); matchPanel.add( insertMatchButton, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(8, 6, 13, 8), 0, 10)); matchPanel.add( matchComboBox, new GridBagConstraints( 0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(8, 8, 13, 0), 258, 11)); printfPanel.add( parameterLabel, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(7, 5, 0, 5), 309, 0)); printfPanel.add( formatLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 5, 0, 5), 288, 0)); printfPanel.add( formatTextArea, new GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 0, 5), 300, 34)); printfPanel.add( parameterTextArea, new GridBagConstraints( 0, 3, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(6, 5, 6, 5), 300, 34)); printfTabPane.addTab("Editor View", null, editorPanel, "View in Editor"); printfTabPane.addTab("Printf View", null, printfPanel, "Vies as Printf"); editorPane.setCharacterAttributes(PLAIN_ATTR, true); editorPane.addStyle("PLAIN", editorPane.getLogicalStyle()); editorPanel.getViewport().add(editorPane, null); this.getContentPane().add(buttonPanel, BorderLayout.SOUTH); buttonGroup.add(cancelButton); }
// CONSTRUCTOR public FACFrame() { // SET PROPERTIES OF THE MAIN FRAME setTitle("Fully Associative Cache"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setIconImage(Toolkit.getDefaultToolkit().createImage(FACFrame.class.getResource("cam.gif"))); // CREATE COMPONENTS AND SET THEIR PROPERTIES // NAVIGATION BUTTONS restart = new JButton("Restart"); next = new JButton("Next"); back = new JButton("Back"); quit = new JButton("Quit"); // CACHE HITS AND MISSES INFO. lCacheHits = new JLabel("Cache Hits"); lCacheMisses = new JLabel("Cache Misses"); tCacheHits = new JTextField(5); tCacheMisses = new JTextField(5); tCacheHits.setEditable(false); tCacheHits.setFont(new Font("Monospaced", Font.BOLD, 14)); tCacheHits.setText(" 0"); tCacheMisses.setEditable(false); tCacheMisses.setFont(new Font("Monospaced", Font.BOLD, 14)); tCacheMisses.setText(" 0"); // PROGRESS UPDATE AREA tProgress = new JTextArea(3, 45); tProgress.setEditable(false); tProgress.setLineWrap(true); tProgress.setWrapStyleWord(true); tProgress.setCaretPosition(0); tProgress.setFont(new Font("Serif", Font.BOLD + Font.ITALIC, 16)); tProgress.setText( "Welcome to Fully Associative Cache!\nThe system specs are as follows -" + "\n 16 Blocks in Cache\n 32 Blocks in Main Memory\n 8 Words per Block" + "\n The replacement algorithm shown is the Least-Recently-Used algorithm" + "\n as it is the most commonly used one." + "\nPlease generate the Address Reference String." + "\nThen click on \"Next\" to continue."); progressScroll = new JScrollPane(); progressScroll.getViewport().add(tProgress); progressScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); lProgress = new JLabel("PROGRESS UPDATE"); // ADDRESS REFERENCE STRING addRefStrList = new JList(); addRefStrList.setEnabled(false); addRefStrScroll = new JScrollPane(); addRefStrScroll.getViewport().setView(addRefStrList); addRefStrScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); addRefStrScroll.setPreferredSize(new Dimension(140, 300)); // BUTTONS USED TO ADDRESS GENERATION autoGen = new JButton("Auto Generate Add. Ref. Str."); selfGen = new JButton("Self Generate Add. Ref. Str."); // BITS IN MAIN MEMORY ADDRESS lBits = new JLabel(" TAG WORD"); tTag = new JTextField(9); tTag.setEditable(false); tWord = new JTextField(7); tWord.setEditable(false); // SET THE FONT STYLES FOR THE BITS IN MAIN MEMORY ADDRESS tTag.setFont(new Font("Monospaced", Font.BOLD, 14)); tWord.setFont(new Font("Monospaced", Font.BOLD, 14)); // REGISTER LISTENERS restart.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { reStart(); } }); next.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { nextClicked = true; step(); } }); back.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { nextClicked = false; step(); } }); quit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int confirmQuit = JOptionPane.showConfirmDialog( null, "Really Quit?", "Quit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); switch (confirmQuit) { case JOptionPane.YES_OPTION: removeInstance(); case JOptionPane.NO_OPTION: break; } } }); autoGen.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { autoGenerateString(); } }); selfGen.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { selfGenerateString(); } }); // DISABLE NAVIGATION BUTTONS FOR NOW next.setEnabled(false); back.setEnabled(false); // CREATE PANELS cachePanel = new FACachePanel(); memoryPanel = new MemoryPanel(); bottomPanel = new JPanel(); cache = new JPanel(); cacheHitsMisses = new JPanel(); pAutoSelfGen = new JPanel(); pAddRefStr = new JPanel(); pEastPanel = new JPanel(); pBitsInMM = new JPanel(); // ADD COMPONENTS TO THE PANELS // PANEL WITH PROGRESS UPDATE TEXT AREA AND NAVIGATION BUTTONS bottomPanel.add(lProgress); bottomPanel.add(progressScroll); bottomPanel.add(restart); bottomPanel.add(next); bottomPanel.add(back); bottomPanel.add(quit); // PANEL WITH CACHE BLOCKS, HITS AND MISSES INFO. cacheHitsMisses.add(lCacheHits); cacheHitsMisses.add(tCacheHits); cacheHitsMisses.add(lCacheMisses); cacheHitsMisses.add(tCacheMisses); cacheHMBorder = BorderFactory.createEtchedBorder(); cacheHitsMisses.setBorder(BorderFactory.createTitledBorder(cacheHMBorder, "")); cache.setLayout(new BorderLayout()); cache.add(cachePanel, "Center"); cache.add(cacheHitsMisses, "South"); // PANEL WITH ADDRESS REFERENCE STRING AND STRING GENERATION BUTTONS pAutoSelfGen.setLayout(new GridLayout(2, 1)); pAutoSelfGen.add(autoGen); pAutoSelfGen.add(selfGen); pAddRefStr.setLayout(new BorderLayout()); pAddRefStr.setPreferredSize(new Dimension(160, 400)); pAddRefStr.add(addRefStrScroll, "Center"); pAddRefStr.add(pAutoSelfGen, "South"); addRefStrBorder = BorderFactory.createEtchedBorder(); pAddRefStr.setBorder( BorderFactory.createTitledBorder(addRefStrBorder, " Address Reference String ")); // PANEL WITH THE MAIN MEMORY ADDRESS BITS INFO. pBitsInMM.setLayout(new BorderLayout()); bitsInMMBorder = BorderFactory.createEtchedBorder(); pBitsInMM.setBorder(BorderFactory.createTitledBorder(bitsInMMBorder, " Main Memory Address ")); pBitsInMM.add(tTag, "Center"); pBitsInMM.add(tWord, "East"); pBitsInMM.add(lBits, "South"); // PANEL CONTAINING THE ADDRESS REF. STRING PANEL AND BITS IN MM PANEL pEastPanel.setLayout(new BorderLayout()); pEastPanel.setPreferredSize(new Dimension(310, 650)); pEastPanel.add(pAddRefStr, "Center"); pEastPanel.add(pBitsInMM, "South"); // ADD COMPONENTS TO THE FRAME CONTAINER Container c = getContentPane(); c.setLayout(new BorderLayout()); c.add(cache, "West"); c.add(memoryPanel, "Center"); c.add(pEastPanel, "East"); c.add(bottomPanel, "South"); // INITIALIZE ARRAYS THAT HOLDS STATUS OF EMPTY AND LRU CACHE BLOCKS for (int i = 0; i < 16; i++) { statusCacheEmpty[i] = true; statusCacheLRU[i] = 0; } /* * CALL THE FUNCTION TO GENERATE THE ARRAY addresses, WHICH CONTAINS ALL THE POSSIBLE MEMORY ADDRESSES * THIS ARRAY WILL BE USEFUL IN THE AUTO GENERATION OF ADDRESSES AS WELL AS FOR VALIDATION OF * ADDRESS STRINGS INPUT BY THE USER IF HE/SHE CHOOSES SELF GENERATION. */ createAddresses(); pack(); } // END CONSTRUCTOR
void jbInit() throws Exception { titledBorder1 = new TitledBorder( BorderFactory.createLineBorder(new Color(153, 153, 153), 2), "Assembler messages"); this.getContentPane().setLayout(borderLayout1); this.setIconifiable(true); this.setMaximizable(true); this.setResizable(true); this.setTitle("EDIT"); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerLocation(470); sourceArea.setFont(new java.awt.Font("Monospaced", 0, 12)); controlPanel.setLayout(gridBagLayout1); controlPanel.setBorder(BorderFactory.createLoweredBevelBorder()); positionPanel.setLayout(gridBagLayout2); fileLabel.setText("Source file:"); fileText.setEditable(false); browseButton.setSelected(false); browseButton.setText("Browse ..."); assembleButton.setEnabled(false); assembleButton.setText("Assemble file"); saveButton.setEnabled(false); saveButton.setText("Save file"); lineLabel.setText("Line:"); lineText.setMinimumSize(new Dimension(50, 20)); lineText.setPreferredSize(new Dimension(50, 20)); lineText.setEditable(false); columnLabel.setText("Column:"); columnText.setMinimumSize(new Dimension(41, 20)); columnText.setPreferredSize(new Dimension(41, 20)); columnText.setEditable(false); columnText.setText(""); messageScrollPane.setBorder(titledBorder1); messageScrollPane.setMinimumSize(new Dimension(33, 61)); messageScrollPane.setPreferredSize(new Dimension(60, 90)); optionsButton.setEnabled(false); optionsButton.setText("Assembler options ..."); messageScrollPane.getViewport().add(messageList, null); messageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.getContentPane().add(splitPane, BorderLayout.CENTER); splitPane.add(textScrollPane, JSplitPane.TOP); splitPane.add(controlPanel, JSplitPane.BOTTOM); textScrollPane.getViewport().add(sourceArea, null); controlPanel.add( fileLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); controlPanel.add( fileText, new GridBagConstraints( 1, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0)); controlPanel.add( browseButton, new GridBagConstraints( 4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); controlPanel.add( optionsButton, new GridBagConstraints( 2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); controlPanel.add( assembleButton, new GridBagConstraints( 3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); controlPanel.add( saveButton, new GridBagConstraints( 4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); controlPanel.add( positionPanel, new GridBagConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); positionPanel.add( lineLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); positionPanel.add( lineText, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0)); positionPanel.add( columnLabel, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0)); positionPanel.add( columnText, new GridBagConstraints( 3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0)); controlPanel.add( messageScrollPane, new GridBagConstraints( 0, 2, 5, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); }
/** * Static Init. * * <pre> * mainPanel * northPanel * centerPanel * xMatched * xPanel * xMathedTo * southPanel * </pre> * * @throws Exception */ private void jbInit() throws Exception { mainPanel.setLayout(mainLayout); northPanel.setLayout(northLayout); // LineRefProv_Label.setText(Msg.getMsg(Env.getCtx(), "RecordNo",new String[] // {""+LineRefProv.getXX_VMR_PO_LineRefProv_ID()})); LineRefProv_Label.setText(""); southPanel.setLayout(southLayout); bNewProduct.setText(Msg.translate(Env.getCtx(), "NewProduct")); bNewProduct.setEnabled(true); bDisassociate.setText(Msg.translate(Env.getCtx(), "Disassociate")); bDisassociate.setEnabled(false); centerPanel.setLayout(centerLayout); xProductScrollPane.setBorder(xProductBorder); xProductScrollPane.setPreferredSize(new Dimension(450, 150)); xAssociateScrollPane.setBorder(xAssociateBorder); xAssociateScrollPane.setPreferredSize(new Dimension(450, 58)); xPanel.setLayout(xLayout); mainPanel.add(northPanel, BorderLayout.NORTH); northPanel.add( LineRefProv_Label, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0)); mainPanel.add(southPanel, BorderLayout.SOUTH); mainPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.add(xProductScrollPane, BorderLayout.NORTH); xProductScrollPane.getViewport().add(xProductTable, null); centerPanel.add(xAssociateScrollPane, BorderLayout.SOUTH); centerPanel.add(xPanel, BorderLayout.CENTER); xAssociateScrollPane.getViewport().add(xAssociateTable, null); southPanel.add( bDisassociate, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 12), 0, 0)); southPanel.add( bNewProduct, new GridBagConstraints( 8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 12, 5, 12), 0, 0)); } // jbInit