List of usage examples for javax.swing.event ChangeListener ChangeListener
ChangeListener
From source file:net.pms.newgui.LooksFrame.java
public JComponent buildMain() { final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP); tabbedPane.setUI(new CustomTabbedPaneUI()); st = new StatusTab(configuration); tt = new TracesTab(configuration, this); gt = new GeneralTab(configuration, this); nt = new NavigationShareTab(configuration, this); tr = new TranscodingTab(configuration, this); ht = new HelpTab(); tabbedPane.addTab(Messages.getString("LooksFrame.18"), st.build()); tabbedPane.addTab(Messages.getString("LooksFrame.19"), tt.build()); tabbedPane.addTab(Messages.getString("LooksFrame.20"), gt.build()); tabbedPane.addTab(Messages.getString("LooksFrame.22"), nt.build()); if (!configuration.isDisableTranscoding()) { tabbedPane.addTab(Messages.getString("LooksFrame.21"), tr.build()); } else {/*from w w w. j a v a 2 s. co m*/ tr.build(); } tabbedPane.addTab(Messages.getString("LooksFrame.24"), new HelpTab().build()); tabbedPane.addTab(Messages.getString("LooksFrame.25"), new AboutTab().build()); tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int selectedIndex = tabbedPane.getSelectedIndex(); if (HELP_PAGES[selectedIndex] != null) { PMS.setHelpPage(HELP_PAGES[selectedIndex]); // Update the contents of the help tab itself ht.updateContents(); } } }); tabbedPane.setBorder(new EmptyBorder(5, 5, 5, 5)); /* * Set the orientation of the tabbedPane. * Note: Do not use applyComponentOrientation() here because it * messes with the layout of several tabs. */ ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale()); tabbedPane.setComponentOrientation(orientation); return tabbedPane; }
From source file:ucar.unidata.idv.flythrough.Flythrough.java
/** * _more_//from w w w .jav a2 s .com * * @return _more_ * * @throws RemoteException _more_ * @throws VisADException _more_ */ public JComponent doMakeViewpointPanel() throws VisADException, RemoteException { JSlider speedSlider = new JSlider(1, 200, 200 - animationSpeed); speedSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider slider = (JSlider) e.getSource(); if (!slider.getValueIsAdjusting()) { animationSpeed = 200 - slider.getValue() + 1; } } }); showTimesCbx = new JCheckBox("Set Animation Time", showTimes); showTimesCbx.setEnabled(hasTimes); animateCbx = new JCheckBox("Animated", animate); changeViewpointCbx = new JCheckBox("Change Viewpoint", changeViewpoint); orients = new Vector<TwoFacedObject>(); orients.add(new TwoFacedObject("Towards Next Point", ORIENT_POINT)); orients.add(new TwoFacedObject("Forward", ORIENT_FORWARD)); orients.add(new TwoFacedObject("Up", ORIENT_UP)); orients.add(new TwoFacedObject("Down", ORIENT_DOWN)); orients.add(new TwoFacedObject("Left", ORIENT_LEFT)); orients.add(new TwoFacedObject("Right", ORIENT_RIGHT)); orientBox = new JComboBox(orients); orientBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { orientation = TwoFacedObject.getIdString(orientBox.getSelectedItem()); goToCurrent(); } }); if (animationInfo == null) { animationInfo = new AnimationInfo(); animationInfo.setShareIndex(true); } ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent ae) { Misc.run(Flythrough.this, "goToCurrent"); } }; //xxxxx animationWidget = new AnimationWidget(null, null, animationInfo); if ((getShareGroup() == null) || getShareGroup().equals(SharableManager.GROUP_ALL)) { setShareGroup("flythrough"); } animationWidget.setShareGroup(getShareGroup()); animationWidget.setSharing(getSharing()); animation = new Animation(); animation.setAnimationInfo(animationInfo); animation.addPropertyChangeListener(this); animationWidget.setAnimation(animation); locationMarker = new SelectorPoint("flythrough.point", ShapeUtility.setSize(ShapeUtility.createShape(ShapeUtility.AIRPLANE3D)[0], .1f), new RealTuple(RealTupleType.SpatialCartesian3DTuple, new double[] { 0, 0, 0 })); locationMarker.setAutoSize(true); locationMarker.setManipulable(false); locationMarker.setColor(Color.green); locationMarker.setVisible(false); locationLine = new LineDrawing("flythroughpoint.line"); locationLine.setVisible(false); locationLine.setLineWidth(2); locationLine.setColor(Color.green); // locationLine2 = new LineDrawing("flythroughpoint.line2"); // locationLine2.setVisible(false); // locationLine2.setLineWidth(2); // locationLine2.setColor(Color.red); // viewManager.getMaster().addDisplayable(locationLine2); Misc.runInABit(2000, this, "setScaleOnMarkers", null); viewManager.getMaster().addDisplayable(locationMarker); viewManager.getMaster().addDisplayable(locationLine); readout = new CursorReadoutWindow(viewManager, false); //zoomFld = new JTextField(zoom + "", 5); zoomFld = new JTextField(Misc.format(zoom), 5); for (int i = 0; i < tilt.length; i++) { final int theIndex = i; tiltSliders[i] = new JSlider(-90, 90, (int) tilt[i]); tiltSliders[i].setToolTipText("Control-R: reset"); tiltSliders[i].addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if ((e.getKeyCode() == KeyEvent.VK_R) && e.isControlDown()) { tilt[theIndex] = 0; tiltLabels[theIndex].setText("" + (int) tilt[theIndex]); tiltSliders[theIndex].setValue(0); goToCurrent(); } } }); tiltLabels[i] = new JLabel("" + (int) tilt[i]); tiltSliders[i].addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider slider = (JSlider) e.getSource(); tiltLabels[theIndex].setText("" + slider.getValue()); if (!slider.getValueIsAdjusting()) { tilt[theIndex] = slider.getValue(); goToCurrent(); } } }); } zoomFld.addActionListener(listener); fixedZCbx = GuiUtils.makeCheckbox("Use fixed Z", this, "useFixedZ"); GuiUtils.tmpInsets = GuiUtils.INSETS_5; JComponent orientationComp = GuiUtils.formLayout(new Component[] { GuiUtils.filler(), GuiUtils.left(changeViewpointCbx), GuiUtils.rLabel("Tilt Down/Up:"), GuiUtils.centerRight(tiltSliders[0], tiltLabels[0]), GuiUtils.rLabel("Tilt Left/Right:"), GuiUtils.centerRight(tiltSliders[1], tiltLabels[1]), GuiUtils.rLabel("Zoom:"), GuiUtils.left(zoomFld), GuiUtils.rLabel("Orientation:"), GuiUtils.left(GuiUtils.hbox(orientBox, (doGlobe() ? GuiUtils.filler() : (JComponent) fixedZCbx))), // GuiUtils.rLabel("Tilt Down/Up:"), GuiUtils.centerRight(tiltSliders[2],tiltLabels[2]), GuiUtils.rLabel("Transitions:"), GuiUtils.vbox(GuiUtils.left(animateCbx), GuiUtils.leftCenter(new JLabel("Speed"), speedSlider)), GuiUtils.filler(), GuiUtils.left(showTimesCbx), }); return GuiUtils.top(orientationComp); }
From source file:com.juanhg.fridge.FridgeApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblO1 = new JLabel("Tiempo On:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTValue = new JLabel(); lblTValue.setText("0"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("Eficiencia:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblEValue = new JLabel(); lblEValue.setText("0"); lblEValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblTiempoOff = new JLabel("Tiempo Off:"); lblTiempoOff.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblOffValue = new JLabel(); lblOffValue.setText("0"); lblOffValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE) .addComponent(lblO1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE) .addGap(31) .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(lblOffValue, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); gl_panelOutputs// w w w . j av a2 s .co m .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblOffValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO1).addComponent(lblTValue)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, gl_panel_control.createSequentialGroup().addContainerGap() .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 305, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(24))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Potencia"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("T1"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("T2"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblT1Value = new JLabel("20"); lblT1Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblT2Value = new JLabel("-15"); lblT2Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPValue = new JLabel("700"); lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderP = new JSlider(); sliderP.setMinimum(500); sliderP.setMaximum(1000); sliderP.setMinorTickSpacing(50); sliderP.setValue(700); sliderP.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderT1 = new JSlider(); sliderT1.setMinimum(18); sliderT1.setMaximum(30); sliderT1.setMinorTickSpacing(1); sliderT1.setValue(20); sliderT1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderT2 = new JSlider(); sliderT2.setMinimum(10); sliderT2.setMaximum(30); sliderT2.setValue(15); sliderT2.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblQo = new JLabel("Qo"); lblQo.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblQcValue = new JLabel("25"); lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderQc = new JSlider(); sliderQc.setMinimum(10); sliderQc.setMaximum(50); sliderQc.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderQc.setValue(25); sliderQc.setMinorTickSpacing(1); btn1 = new JButton("1"); btn1.setFont(new Font("Tahoma", Font.PLAIN, 21)); btn1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnMilk.setEnabled(false); btnFish.setEnabled(false); btnMetal.setEnabled(false); btn1.setEnabled(false); btn2.setEnabled(true); sliderQc.setEnabled(true); lblQcValue.setText("" + sliderQc.getValue()); } }); btn2 = new JButton("2"); btn2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMilk.setEnabled(true); btnFish.setEnabled(true); btnMetal.setEnabled(true); btn1.setEnabled(true); btn2.setEnabled(false); phase = 2; sliderQc.setEnabled(false); lblQcValue.setText("-"); } }); btn2.setFont(new Font("Tahoma", Font.PLAIN, 21)); fishImage = loadImage(fish); btnFish = new JButton(new ImageIcon(fishImage)); btnFish.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnFishFunction(); } }); milkImage = loadImage(milk); btnMilk = new JButton(new ImageIcon(milkImage)); btnMilk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMilkFunction(); } }); metalImage = loadImage(metal); btnMetal = new JButton(new ImageIcon(metalImage)); btnMetal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnMetalFunction(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs .setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addGap(38).addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING).addGroup( gl_panelInputs.createSequentialGroup().addGap(36) .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING, false) .addComponent(lblQo, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelI1, GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING) .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING, false) .addComponent(sliderT1, 0, 0, Short.MAX_VALUE) .addComponent(sliderP, GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) .addComponent(sliderT2, 0, 0, Short.MAX_VALUE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderQc, 0, 0, Short.MAX_VALUE))))) .addContainerGap(14, Short.MAX_VALUE)) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addContainerGap(28, Short.MAX_VALUE) .addComponent(btnFish, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addGap(25))); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelI1).addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelI2).addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderT1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderT2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblQo, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE) .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createSequentialGroup().addGap(1).addComponent(btnFish, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap(12, Short.MAX_VALUE))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 398, GroupLayout.PREFERRED_SIZE) .addGap(452))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout .createSequentialGroup() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addGap(12).addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)) .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); JPanel panel = new JPanel(); panelGrafica = new JPanelGrafica(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 384, Short.MAX_VALUE) .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)); panel.setLayout(gl_panel); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }
From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java
private void initGUI() { try {/*from w w w . j ava2s .c o m*/ this.setPreferredSize(new java.awt.Dimension(975, 563)); { jMainSplitPane = new JSplitPane(); this.add(getJErrorLabel(), "errorLabel"); this.add(jMainSplitPane, "MAIN"); jMainSplitPane.setDividerLocation(200); { jPanel4 = new JPanel(); jMainSplitPane.add(jPanel4, JSplitPane.RIGHT); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); { jSplitPane3 = new JSplitPane(); jPanel4.add(jSplitPane3, BorderLayout.CENTER); jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane3.setDividerLocation(500); { jPanel6 = new JPanel(); jSplitPane3.add(jPanel6, JSplitPane.TOP); jSplitPane3.add(getJInfoTabbedPane(), JSplitPane.BOTTOM); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); { jMainTabbedPane = new JMaximizableTabbedPane(); jPanel6.add(jMainTabbedPane, BorderLayout.CENTER); { jASMPanel = new JPanel(); jMainTabbedPane.addTab(MyLanguage.getString("ASM/C"), null, jASMPanel, null); jMainTabbedPane.addTab("Dwarf", null, getJDwarfPanel(), null); jMainTabbedPane.addTab("Code base", null, getCodeBasePanel(), null); jMainTabbedPane.addTab("Call Graph", null, getCallGraphPanel(), null); BorderLayout jASMPanelLayout = new BorderLayout(); jASMPanel.setLayout(jASMPanelLayout); { instructionTableScrollPane = new JScrollPane(); instructionTableScrollPane.getVerticalScrollBar() .addAdjustmentListener(new AdjustmentListener() { boolean isRunning; public void adjustmentValueChanged(AdjustmentEvent evt) { /* JScrollBar vbar = (JScrollBar) evt.getSource(); if (evt.getValueIsAdjusting()) { return; } if ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum()) { if (!isRunning) { try { isRunning = true; final CardLayout cl = (CardLayout) (peterBochsDebugger.jMainPanel.getLayout()); cl.show(peterBochsDebugger.jMainPanel, "Running Label"); // new Thread("update instruction thread") { // public void run() { // long address = Long.parseLong(instructionTable.getValueAt(instructionTable.getRowCount() - 1, 1).toString() // .substring(2), 16); // peterBochsDebugger.updateInstruction(address, true); // peterBochsDebugger.updateBreakpointTableColor(); //// cl.show(peterBochsDebugger.jMainPanel, peterBochsDebugger.currentPanel); // // isRunning = false; // } // }.start(); } catch (Exception ex) { } } }*/ } }); jASMPanel.add(instructionTableScrollPane, BorderLayout.CENTER); { instructionTable = new JTable(); instructionTableScrollPane.setViewportView(instructionTable); instructionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); instructionTable .setModel(PeterBochsDebugger.instructionTable.getModel()); instructionTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); instructionTable.getTableHeader().setReorderingAllowed(false); instructionTable.getColumnModel().getColumn(0).setMaxWidth(20); instructionTable.getColumnModel().getColumn(1).setPreferredWidth(40); instructionTable.getColumnModel().getColumn(2).setPreferredWidth(200); instructionTable.getColumnModel().getColumn(3).setPreferredWidth(40); instructionTable.setShowGrid(false); instructionTable.setDefaultRenderer(String.class, new InstructionTableCellRenderer()); instructionTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { instructionTableMouseClicked(evt); } }); } } { jInstructionControlPanel = new JPanel(); jASMPanel.add(jInstructionControlPanel, BorderLayout.NORTH); { jInstructionComboBox = new JComboBox(); jInstructionControlPanel.add(jInstructionComboBox); jInstructionComboBox.setEditable(true); jInstructionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionComboBoxActionPerformed(evt); } }); } { disassembleButton = new JButton(); jInstructionControlPanel.add(disassembleButton); disassembleButton.setText(MyLanguage.getString("Disassemble")); disassembleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { disassembleButtonActionPerformed(evt); } }); } { disassembleCSEIPButton = new JButton(); jInstructionControlPanel.add(disassembleCSEIPButton); disassembleCSEIPButton .setText(MyLanguage.getString("Disassemble") + " cs:eip"); disassembleCSEIPButton.setEnabled(true); disassembleCSEIPButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { disassembleCSEIPButtonActionPerformed(evt); } }); } { jInstructionUpTenButton = new JButton(); jInstructionControlPanel.add(jInstructionUpTenButton); jInstructionUpTenButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_up10.png"))); jInstructionUpTenButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionUpTenButtonActionPerformed(evt); } }); } { jInstructionUpButton = new JButton(); jInstructionControlPanel.add(jInstructionUpButton); jInstructionUpButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_up1.png"))); jInstructionUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionUpButtonActionPerformed(evt); } }); } { jInstructionDownButton = new JButton(); jInstructionControlPanel.add(jInstructionDownButton); jInstructionDownButton .setIcon(new ImageIcon(getClass().getClassLoader().getResource( "com/peterbochs/icons/famfam_icons/arrow_down.png"))); jInstructionDownButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jInstructionDownButtonActionPerformed(evt); } }); } { jDiskButton = new JButton(); jInstructionControlPanel.add(jDiskButton); jDiskButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/disk.png"))); jDiskButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton3ActionPerformed(evt); } }); } { jExcelButton = new JButton(); jInstructionControlPanel.add(jExcelButton); jInstructionControlPanel.add(getJSearchTextField()); jExcelButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/peterbochs/icons/famfam_icons/excel.gif"))); { btnSearch = new JButton("Search"); jInstructionControlPanel.add(btnSearch); btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnSearchActionPerformed(evt); } }); } { onOffButton = new OnOffButton(); onOffButton.setSelected(true); onOffButton.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { InstructionTableModel model = (InstructionTableModel) PeterBochsDebugger.instructionTable .getModel(); if (e.getStateChange() == ItemEvent.SELECTED) { model.showAsmLevel = true; } else { model.showAsmLevel = false; } model.fireTableDataChanged(); } }); onOffButton.setPreferredSize(new Dimension(53, 18)); jInstructionControlPanel.add(onOffButton); } jExcelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton12ActionPerformed(evt); } }); } } } } } } } { jPanel1 = new JPanel(); jMainSplitPane.add(jPanel1, JSplitPane.LEFT); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); { jTabbedPane1 = new JMaximizableTabbedPane(); jPanel1.add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { jTabbedPane1StateChanged(evt); } }); { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("Symbol", null, getSymbolTablePanel(), null); jTabbedPane1.addTab(MyLanguage.getString("Project"), null, jPanel3, null); { jScrollPane1 = new JScrollPane(); jPanel3.add(jScrollPane1, BorderLayout.CENTER); jPanel3.add(getJProjectToolBar(), BorderLayout.NORTH); { projectTree = new JTree(); jScrollPane1.setViewportView(projectTree); projectTree.setModel(projectFilterTreeModel); projectTree.setShowsRootHandles(true); projectTree.setCellRenderer(new ProjectTreeRenderer()); projectTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { projectTreeMouseClicked(evt); } }); } } } } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.juanhg.triangle.TriangleApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblO1 = new JLabel("Tensi\u00F3n:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTValue = new JLabel(); lblTValue.setText("0"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("V:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO3 = new JLabel("tfinal:"); lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTfValue = new JLabel(); lblTfValue.setText("0"); lblTfValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblW = new JLabel("W:"); lblW.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblWValue = new JLabel(); lblWValue.setText("0"); lblWValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblO2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblO1, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblVValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTValue, GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO3, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblTfValue, GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); gl_panelOutputs/*from w ww. j a v a 2s . c o m*/ .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblO1) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblTValue) .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent( lblTfValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs .createParallelGroup(Alignment.BASELINE) .addComponent(lblW, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblWValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))) .addGap(107))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.LEADING) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE).addComponent( panelOutputs, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addGap(13) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(24))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Roz Est\u00E1tico"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("Roz Din\u00E1mico"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("Masa"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblMudValue = new JLabel("0.1"); lblMudValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMValue = new JLabel("10"); lblMValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMueValue = new JLabel("0.4"); lblMueValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderMue = new JSlider(); sliderMue.setMinimum(15); sliderMue.setMaximum(80); sliderMue.setMinorTickSpacing(1); sliderMue.setValue(40); sliderMue.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderMud = new JSlider(); sliderMud.setMinimum(5); sliderMud.setMaximum(15); sliderMud.setMinorTickSpacing(1); sliderMud.setValue(10); sliderMud.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderIM = new JSlider(); sliderIM.setMinimum(1); sliderIM.setMaximum(20); sliderIM.setValue(10); sliderIM.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblI4 = new JLabel("\u00C1ngulo"); lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblZValue = new JLabel("45\u00BA"); lblZValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderZ = new JSlider(); sliderZ.setMinimum(20); sliderZ.setMaximum(60); sliderZ.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderZ.setValue(45); sliderZ.setMinorTickSpacing(1); btnCilindro = new JButton(new ImageIcon(loadImage(cilindro))); btnCilindro.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { type = CILINDRO; btnCilindro.setEnabled(false); btnEsfera.setEnabled(true); btnCubo.setEnabled(true); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage1, xPulley, yPulley); updatePanels(); repaint(); } }); btnEsfera = new JButton(new ImageIcon(loadImage(esfera))); btnEsfera.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { type = ESFERA; btnCilindro.setEnabled(true); btnEsfera.setEnabled(false); btnCubo.setEnabled(true); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage2, xPulley, yPulley); updatePanels(); repaint(); } }); btnCubo = new JButton(new ImageIcon(loadImage(cubo))); btnCubo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { type = CUBO; btnCilindro.setEnabled(true); btnEsfera.setEnabled(true); btnCubo.setEnabled(false); chartTriangle.deleteAnnotation(pulleyAnnotation); pulleyAnnotation = chartTriangle.setImageAtPoint(pulleyImage3, xPulley, yPulley); updatePanels(); repaint(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING).addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblMueValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblMudValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderMue, 0, 0, Short.MAX_VALUE) .addComponent(sliderMud, 0, 0, Short.MAX_VALUE).addComponent( sliderIM, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(lblZValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderZ, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGap(19)) .addGroup(Alignment.LEADING, gl_panelInputs.createSequentialGroup().addGap(35) .addComponent(btnCilindro, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(btnEsfera, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(btnCubo, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addContainerGap(42, Short.MAX_VALUE))); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelI1).addComponent(lblMueValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderMue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelI2).addComponent(lblMudValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderMud, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lblMValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderIM, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblZValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderZ, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(36) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(btnCubo, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addComponent(btnEsfera, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addComponent(btnCilindro, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 696, GroupLayout.PREFERRED_SIZE) .addContainerGap(149, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) .addComponent(panel_visualizar, Alignment.TRAILING, 0, 0, Short.MAX_VALUE) .addComponent(panel_control, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 568, Short.MAX_VALUE)) .addContainerGap())); JPanel panel = new JPanel(); panelGrafica = new JPanelGrafica(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 686, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)); panel.setLayout(gl_panel); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 414, GroupLayout.PREFERRED_SIZE) .addContainerGap(272, Short.MAX_VALUE))); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.DEFAULT_SIZE, 546, Short.MAX_VALUE).addContainerGap())); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }
From source file:com.diversityarrays.kdxplore.trialmgr.trait.TraitExplorerPanel.java
public TraitExplorerPanel(MessagePrinter mp, OfflineData od, DALClientProvider clientProvider, // KdxUploadHandler uploadHandler, BackgroundRunner backgroundRunner, ImageIcon addBarcodeIcon, Transformer<Trial, Boolean> checkIfEditorActive) { super(new BorderLayout()); this.backgroundRunner = backgroundRunner; this.clientProvider = clientProvider; // this.uploadHandler = uploadHandler; this.messagePrinter = mp; this.offlineData = od; this.checkIfEditorActive = checkIfEditorActive; offlineData.addOfflineDataChangeListener(offlineDataListener); editingLocked.setIcon(KDClientUtils.getIcon(ImageId.LOCKED)); editingLocked.addActionListener(new ActionListener() { @Override// w w w.j a va 2 s . c o m public void actionPerformed(ActionEvent e) { changeEditable(editingLocked.isSelected(), DONT_OVERRIDE); } }); changeManager.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateUndoRedoActions(); } }); KDClientUtils.initAction(ImageId.TRASH_24, deleteTraitsAction, "Remove Trait"); deleteTraitsAction.setEnabled(false); KDClientUtils.initAction(ImageId.REFRESH_24, refreshAction, "Refresh Data"); KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addNewTraitAction, "Add Trait"); KDClientUtils.initAction(ImageId.UPLOAD_24, uploadTraitsAction, "Upload Traits"); KDClientUtils.initAction(ImageId.ADD_TRIALS_24, importTraitsAction, "Import Traits"); KDClientUtils.initAction(ImageId.EXPORT_24, exportTraitsAction, "Export Traits"); try { Class.forName("com.diversityarrays.kdxplore.upload.TraitUploadTask"); } catch (ClassNotFoundException e1) { uploadTraitsAction.setEnabled(false); if (RunMode.getRunMode().isDeveloper()) { new Toast((JComponent) null, "<HTML>Developer Warning<BR>" + "Trait Upload currently unavailable<BR>", 4000) .showAsError(); } } traitPropertiesTable .setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(traitPropertiesTable, true)); traitPropertiesTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { if (traitPropertiesTableModel.getRowCount() > 0) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { GuiUtil.initialiseTableColumnWidths(traitPropertiesTable); } }); traitPropertiesTableModel.removeTableModelListener(this); } } }); traitTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { showCorrectCard(); } }); TrialManagerPreferences preferences = TrialManagerPreferences.getInstance(); preferences.addChangeListener(TrialManagerPreferences.BAD_FOR_CALC, badForCalcColorChangeListener); badForCalc.setForeground(preferences.getBadForCalcColor()); badForCalc.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { KdxPreference<Color> pref = TrialManagerPreferences.BAD_FOR_CALC; String title = pref.getName(); KdxplorePreferenceEditor.startEditorDialog(TraitExplorerPanel.this, title, pref); } } }); traitsTable.setAutoCreateRowSorter(true); int index = traitTableModel.getTraitNameColumnIndex(); if (index >= 0) { traitsTable.getColumnModel().getColumn(index).setCellRenderer(traitNameCellRenderer); } traitsTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && 2 == e.getClickCount()) { e.consume(); int vrow = traitsTable.rowAtPoint(e.getPoint()); if (vrow >= 0) { int mrow = traitsTable.convertRowIndexToModel(vrow); if (mrow >= 0) { Trait trait = traitTableModel.getTraitAtRow(mrow); Integer selectViewRow = null; if (!traitTrialsTableModel.isSelectedTrait(trait)) { selectViewRow = vrow; } if (traitsEditable) { startEditingTraitInternal(trait, selectViewRow, null); } else { warnEditingLocked(); } } } } } }); traitsTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); traitsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { List<Trait> selectedTraits = getSelectedTraits(); traitTrialsTableModel.setSelectedTraits(selectedTraits); if (selectedTraits.size() == 1) { Trait trait = null; int vrow = traitsTable.getSelectedRow(); if (vrow >= 0) { int mrow = traitsTable.convertRowIndexToModel(vrow); if (mrow >= 0) { trait = traitTableModel.getEntityAt(mrow); } } showTraitDetails(trait); } deleteTraitsAction.setEnabled(selectedTraits.size() > 0); showCorrectCard(); } } }); TraitTableModel.initValidationExpressionRenderer(traitsTable); if (RunMode.getRunMode().isDeveloper()) { TraitTableModel.initTableForRawExpression(traitsTable); } cardPanel.add(noTraitsComponent, CARD_NO_TRAITS); cardPanel.add(selectTraitComponent, CARD_SELECT_TO_EDIT); cardPanel.add(new JScrollPane(traitPropertiesTable), CARD_TRAIT_EDITOR); JButton undoButton = initAction(undoAction, ImageId.UNDO_24, "Undo", KeyStroke.getKeyStroke('Z', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); JButton redoButton = initAction(redoAction, ImageId.REDO_24, "Redo", KeyStroke.getKeyStroke('Y', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); Box undoRedoButtons = Box.createHorizontalBox(); undoRedoButtons.add(undoButton); undoRedoButtons.add(redoButton); JPanel detailsPanel = new JPanel(new BorderLayout()); detailsPanel.add(GuiUtil.createLabelSeparator("Details", undoRedoButtons), BorderLayout.NORTH); detailsPanel.add(cardPanel, BorderLayout.CENTER); detailsPanel.add(legendPanel, BorderLayout.SOUTH); PromptScrollPane scrollPane = new PromptScrollPane(traitsTable, "Drag/Drop Traits CSV file or use 'Import Traits'"); TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(traitsTable, true); traitsTable.setTransferHandler(new ChainingTransferHandler(flth, tth)); scrollPane.setTransferHandler(flth); if (addBarcodeIcon == null) { barcodesMenuAction.putValue(Action.NAME, "Barcodes..."); } else { barcodesMenuAction.putValue(Action.SMALL_ICON, addBarcodeIcon); } italicsForProtectedCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { traitNameCellRenderer.setUseItalicsForProtected(italicsForProtectedCheckbox.isSelected()); traitsTable.repaint(); } }); Box leftTopControls = Box.createHorizontalBox(); leftTopControls.add(importTraitsButton); leftTopControls.add(barcodesMenuButton); leftTopControls.add(new JButton(addNewTraitAction)); leftTopControls.add(new JButton(uploadTraitsAction)); leftTopControls.add(new JButton(exportTraitsAction)); leftTopControls.add(Box.createHorizontalGlue()); leftTopControls.add(editingLocked); leftTopControls.add(fixTraitLevelsButton); leftTopControls.add(refreshButton); leftTopControls.add(Box.createHorizontalStrut(8)); leftTopControls.add(new JButton(deleteTraitsAction)); // leftTopControls.add(Box.createHorizontalStrut(4)); Box explanations = Box.createHorizontalBox(); explanations.add(italicsForProtectedCheckbox); explanations.add(badForCalc); explanations.add(Box.createHorizontalGlue()); fixTraitLevelsButton.setToolTipText("Fix Traits with " + TraitLevel.UNDECIDABLE.visible + " 'Level'"); fixTraitLevelsButton.setVisible(false); JPanel leftTop = new JPanel(new BorderLayout()); leftTop.add(leftTopControls, BorderLayout.NORTH); leftTop.add(scrollPane, BorderLayout.CENTER); leftTop.add(explanations, BorderLayout.SOUTH); JPanel leftBot = new JPanel(new BorderLayout()); leftBot.add(GuiUtil.createLabelSeparator("Used by Trials"), BorderLayout.NORTH); leftBot.add(new PromptScrollPane(traitTrialsTable, "Any Trials using selected Traits appear here")); JSplitPane leftSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, leftTop, leftBot); leftSplit.setResizeWeight(0.5); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSplit, detailsPanel); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); add(splitPane, BorderLayout.CENTER); }
From source file:jatoo.app.App.java
private JPopupMenu getWindowPopup(final Point location) { ///*from w w w .ja va2 s . c o m*/ // hide final JMenuItem hideItem = new JMenuItem(getText("popup.hide")); hideItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { hide(); } }); // // send to back final JMenuItem sendToBackItem = new JMenuItem(getText("popup.send_to_back")); sendToBackItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { sendToBack(); } }); // // always on top final JCheckBoxMenuItem alwaysOnTopItem = new JCheckBoxMenuItem(getText("popup.always_on_top"), isAlwaysOnTop()); alwaysOnTopItem.addItemListener(new ItemListener() { public void itemStateChanged(final ItemEvent e) { setAlwaysOnTop(alwaysOnTopItem.isSelected()); } }); // // transparency final JSlider transparencySlider = new JSlider(JSlider.VERTICAL, 0, 100, getTransparency()); transparencySlider.setMajorTickSpacing(25); transparencySlider.setMinorTickSpacing(5); transparencySlider.setSnapToTicks(true); transparencySlider.setPaintTicks(true); transparencySlider.setPaintLabels(true); transparencySlider.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { setTransparency(transparencySlider.getValue()); } }); final JMenu transparencyItem = new JMenu(getText("popup.transparency")); transparencyItem.add(transparencySlider); // // close final JMenuItem closeItem = new JMenuItem(getText("popup.close"), getIcon("close-016.png")); closeItem.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { System.exit(0); } }); // // the popup JPopupMenu popup = new JPopupMenu(getTitle()); popup.add(hideItem); popup.addSeparator(); popup.add(sendToBackItem); popup.add(alwaysOnTopItem); popup.add(transparencyItem); popup.addSeparator(); popup.add(closeItem); popup.setInvoker(popup); popup.setLocation(location); return popup; }
From source file:at.becast.youploader.gui.FrmMain.java
public void initQueuetab() { JScrollPane TabQueues = new JScrollPane(); QueuePanel = new JPanel(); TabQueues.setViewportView(QueuePanel); QueuePanel.setLayout(new MigLayout("", "[875px,grow,fill]", "[][][][]")); JPanel buttonPanel = new JPanel(); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.fill = GridBagConstraints.BOTH; gbc_panel_2.gridx = 0;//from w w w . ja v a 2 s.co m gbc_panel_2.gridy = 1; buttonPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(39dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(92dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(46dlu;min)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(22dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(0dlu;default)"), })); JButton btnStart = new JButton(LANG.getString("frmMain.start")); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startUploads(); } }); JLabel lblAfterUploadsFinish = new JLabel(LANG.getString("frmMain.afterfinish")); buttonPanel.add(lblAfterUploadsFinish, "10, 2, 7, 1"); buttonPanel.add(btnStart, "2, 4"); JButton btnStop = new JButton(LANG.getString("frmMain.stop")); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UploadMgr.stop(); } }); buttonPanel.add(btnStop, "6, 4"); cmbAfterFinish = new JComboBox<Object>(); cmbAfterFinish.setModel(new DefaultComboBoxModel<Object>(new String[] { LANG.getString("frmMain.afterfinish.donothing"), LANG.getString("frmMain.afterfinish.suspend"), LANG.getString("frmMain.afterfinish.shutdown") })); buttonPanel.add(cmbAfterFinish, "10, 4, 7, 1, fill, default"); JLabel lblUploads = new JLabel(LANG.getString("frmMain.uploads") + ":"); buttonPanel.add(lblUploads, "18, 4, right, fill"); JSlider slider = new JSlider(); slider.setPaintTicks(true); slider.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { JSlider s = (JSlider) evt.getSource(); UploadMgr.setUploadlimit(s.getValue()); } }); slider.setMajorTickSpacing(1); slider.setMinorTickSpacing(1); slider.setMinimum(1); slider.setMaximum(5); slider.setValue(1); slider.setSnapToTicks(true); slider.setPaintLabels(true); buttonPanel.add(slider, "20, 4, fill, fill"); JLabel lblUploadSpeed = new JLabel(LANG.getString("frmMain.uploadspeed") + ":"); lblUploadSpeed.setHorizontalAlignment(SwingConstants.TRAILING); buttonPanel.add(lblUploadSpeed, "24, 4"); spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(10))); spinner.setEditor(new SpeedValuesSpinnerEditor(spinner)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner s = (JSpinner) e.getSource(); speed = Integer.parseInt(s.getValue().toString()); Main.s.put("speed", String.valueOf(speed)); UploadMgr.setLimit(speed); } }); spinner.setValue(speed); buttonPanel.add(spinner, "26, 4"); JLabel lblKbps = new JLabel("kbps"); buttonPanel.add(lblKbps, "28, 4"); JPanel TabQueue = new JPanel(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.Queue"), null, TabQueue, null); TabQueue.setLayout(new BorderLayout(0, 0)); TabQueue.add(buttonPanel, BorderLayout.SOUTH); TabQueue.add(TabQueues, BorderLayout.CENTER); }
From source file:org.forester.archaeopteryx.ControlPanel.java
private void buildJSlider(int width, int min, int max) { _color_branches_edpl_slider = new JSlider(min, max); Dimension d = _color_branches_edpl_slider.getSize(); d.width = width;//from w w w . ja v a 2 s.c om d.height = 100; _color_branches_edpl_slider.setPreferredSize(d); // _color_branches_edpl_slider.setLayout(null); // slider popup with cutoff value _slider_popup = new JPopupMenu(); JLabel text = new JLabel(); text.setText(String.valueOf(_edpl_current_cutoff)); _slider_popup.add(text); if (!_configuration.isUseNativeUI()) { _color_branches_edpl_slider.setBackground(ControlPanel.jcb_background_color); _color_branches_edpl_slider.setForeground(ControlPanel.jcb_text_color); } _color_branches_edpl_slider.setToolTipText("Set cutoff for EDPL (0.5-1.0)"); _color_branches_edpl_slider.setMinorTickSpacing(10); _color_branches_edpl_slider.setMajorTickSpacing(50); _color_branches_edpl_slider.setPaintTicks(true); _color_branches_edpl_slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // get Treepanel function final TreePanel tp = getMainPanel().getCurrentTreePanel(); if (tp == null) { return; } Phylogeny phy = tp.getPhylogeny(); _edpl_next_cutoff = ((double) ((JSlider) (e.getSource())).getValue() / 100.0); tp.edplSliderMovement(_edpl_next_cutoff, _edpl_current_cutoff); _edpl_current_cutoff = _edpl_next_cutoff; // System.out.println("Neuer Wert: "+ // ((JSlider)(e.getSource())).getValue()); } }); _color_branches_edpl_slider.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseMoved(MouseEvent e) { if (_color_branches_edpl_slider.isEnabled()) { _slider_popup.setVisible(false); } } @Override public void mouseDragged(MouseEvent e) { if (_color_branches_edpl_slider.isEnabled()) { // Point p = getMainPanel().getMainFrame().getLocation(); Point p = _color_branches_edpl_slider.getLocationOnScreen(); JLabel text = (JLabel) _slider_popup.getComponent(0); text.setText(String.valueOf(_edpl_current_cutoff)); int x = (int) p.getX() + 18; int y = (int) p.getY() - 25; _slider_popup.setLocation(x, y); _slider_popup.setVisible(true); } } }); }
From source file:GUI.ServerUI_Client.java
private void jActiveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jActiveButtonActionPerformed try {// w w w .j av a 2 s .c o m if (jActiveButton.isSelected()) { setInterfaceEnable(true); jRadioClientButton.setSelected(true); jRadioServerButton.setEnabled(false); jTextIPserver.setEnabled(false); jTextPortServer.setEnabled(false); addr = InetAddress.getLocalHost(); jTextIPclient.setText(addr.getHostAddress()); jTextPortClient.setText(String.valueOf(Constants.SERVERPORT)); ; Log("Server started! \n"); //Spinners Listeners //Packet Size jSpinner3.setValue((Integer) Constants.BUFFERSIZE); jSpinner3.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Constants.BUFFERSIZE = (Integer) jSpinner3.getValue(); } }); //Socket rcv Buffer jSpinner4.setValue((Integer) Constants.SOCKET_RCVBUF); jSpinner4.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Constants.SOCKET_RCVBUF = (Integer) jSpinner4.getValue(); } }); //Socket snd Buffer jSpinner5.setValue((Integer) Constants.SOCKET_SNDBUF); jSpinner5.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Constants.SOCKET_SNDBUF = (Integer) jSpinner5.getValue(); } }); //Socket Timeout jSpinner6.setValue((Integer) Constants.SO_TIMEOUT); jSpinner6.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Constants.SO_TIMEOUT = (Integer) jSpinner6.getValue(); } }); } else { setInterfaceEnable(false); jRadioClientButton.setSelected(false); jRadioServerButton.setSelected(false); //tcpServ.interrupt(); } } catch (Exception ex) { ex.printStackTrace(); } }