Java Code Examples for javax.swing.JSlider#setPaintTicks()
The following examples show how to use
javax.swing.JSlider#setPaintTicks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimeSeriesPlayerForm.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private JSlider createSpeedSlider() { final JSlider speedSlider = new JSlider(1, 10); speedSlider.setToolTipText("Choose the playing speed"); speedSlider.setSnapToTicks(true); speedSlider.setPaintTrack(true); speedSlider.setPaintTicks(true); speedSlider.setPaintLabels(true); speedSlider.setValue(6); speedSlider.setPreferredSize(new Dimension(80, speedSlider.getPreferredSize().height)); speedSlider.addChangeListener(e -> { timerDelay = calculateTimerDelay(); timer.setDelay(timerDelay); updateSpeedUnit(); }); return speedSlider; }
Example 2
Source File: ObjectTracking.java From marvinproject with GNU Lesser General Public License v3.0 | 6 votes |
private void loadGUI(){ setTitle("Video Sample - Tracking"); videoPanel.addMouseListener(new MouseHandler()); sliderSensibility = new JSlider(JSlider.HORIZONTAL, 0, 60, 30); sliderSensibility.setMinorTickSpacing(2); sliderSensibility.setPaintTicks(true); sliderSensibility.addChangeListener(new SliderHandler()); labelSlider = new JLabel("Sensibility"); panelSlider = new JPanel(); panelSlider.add(labelSlider); panelSlider.add(sliderSensibility); Container l_container = getContentPane(); l_container.setLayout(new BorderLayout()); l_container.add(videoPanel, BorderLayout.NORTH); l_container.add(panelSlider, BorderLayout.SOUTH); setSize(imageWidth+20,imageHeight+100); setVisible(true); }
Example 3
Source File: TrackingPong.java From marvinproject with GNU Lesser General Public License v3.0 | 6 votes |
private void loadGUI(){ setTitle("Video Sample - Tracking Pong"); videoPanel.addMouseListener(new MouseHandler()); sliderSensibility = new JSlider(JSlider.HORIZONTAL, 0, 60, 30); sliderSensibility.setMinorTickSpacing(2); sliderSensibility.setPaintTicks(true); sliderSensibility.addChangeListener(new SliderHandler()); labelSlider = new JLabel("Sensibility"); panelSlider = new JPanel(); panelSlider.add(labelSlider); panelSlider.add(sliderSensibility); Container container = getContentPane(); container.setLayout(new BorderLayout()); container.add(videoPanel, BorderLayout.NORTH); container.add(panelSlider, BorderLayout.SOUTH); setSize(videoInterface.getImageWidth()+20,videoInterface.getImageHeight()+100); setVisible(true); }
Example 4
Source File: ContrastAdjustmentMode.java From TrakEM2 with GNU General Public License v3.0 | 6 votes |
private JSlider createSlider(JPanel panel, GridBagLayout gb, GridBagConstraints c, String title, Font font, int sliderRange, int start) { Utils.log2("createSlider range: " + sliderRange + ", start: " + start); JSlider s = new JSlider(JSlider.HORIZONTAL, 0, sliderRange, start); s.setPaintLabels(false); s.setPaintTicks(false); s.setBackground(Color.white); c.gridy++; c.insets = new Insets(2, 10, 0, 10); gb.setConstraints(s, c); panel.add(s); JLabel l = new JLabel(title); l.setBackground(Color.white); l.setFont(font); c.gridy++; c.insets = new Insets(0, 10, IJ.isMacOSX() ? 4 : 0, 0); JPanel p = new JPanel(); p.setBackground(Color.white); p.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); gb.setConstraints(p, c); p.add(l); panel.add(p); return s; }
Example 5
Source File: GUIWithSmartClock.java From txtUML with Eclipse Public License 1.0 | 6 votes |
private JSlider createSlider() { slider = new JSlider(SwingConstants.VERTICAL, 0, 30, 0); slider.addChangeListener(e -> { if (!slider.getValueIsAdjusting()) { model.changeTime(slider.getValue()); } }); slider.setMajorTickSpacing(5); slider.setMinorTickSpacing(1); slider.createStandardLabels(10); slider.setPaintTicks(true); slider.setPaintLabels(true); return slider; }
Example 6
Source File: DetectMotionRegions.java From marvinproject with GNU Lesser General Public License v3.0 | 6 votes |
private void loadGUI(){ setTitle("Video Sample - Detect Motion Regions"); sliderSensibility = new JSlider(JSlider.HORIZONTAL, 0, 60, 30); sliderSensibility.setMinorTickSpacing(2); sliderSensibility.setPaintTicks(true); sliderSensibility.addChangeListener(new SliderHandler()); labelSlider = new JLabel("Sensibility"); panelSlider = new JPanel(); panelSlider.add(labelSlider); panelSlider.add(sliderSensibility); Container container = getContentPane(); container.setLayout(new BorderLayout()); container.add(videoPanel, BorderLayout.NORTH); container.add(panelSlider, BorderLayout.SOUTH); setSize(imageWidth+10,imageHeight+100); setVisible(true); }
Example 7
Source File: FuzzerOptionsPanel.java From zap-extensions with Apache License 2.0 | 6 votes |
private static JSlider createDefaultFuzzDelayInMsSlider( int delayInMs, int maxDelayInMs, final JLabel currentValueFeedbackLabel) { final JSlider delaySlider = new JSlider(); delaySlider.setMinimum(0); delaySlider.setValue(delayInMs); delaySlider.setMaximum(maxDelayInMs); delaySlider.setMinorTickSpacing(25); delaySlider.setMajorTickSpacing(100); delaySlider.setPaintTicks(true); delaySlider.setPaintLabels(true); delaySlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { currentValueFeedbackLabel.setText(Integer.toString(delaySlider.getValue())); } }); return delaySlider; }
Example 8
Source File: FuzzOptionsPanel.java From zap-extensions with Apache License 2.0 | 6 votes |
private static JSlider createDefaultFuzzDelayInMsSlider( int defaultDelayInMs, int maxDelayInMs, final JLabel currentValueFeedbackLabel) { final JSlider delaySlider = new JSlider(); delaySlider.setMinimum(0); delaySlider.setValue(defaultDelayInMs); delaySlider.setMaximum(maxDelayInMs); delaySlider.setMinorTickSpacing(25); delaySlider.setMajorTickSpacing(100); delaySlider.setPaintTicks(true); delaySlider.setPaintLabels(true); delaySlider.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { currentValueFeedbackLabel.setText(Integer.toString(delaySlider.getValue())); } }); return delaySlider; }
Example 9
Source File: DeltaRobot3Panel.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
protected CollapsiblePanel createSpeedPanel() { double speed=robot.getSpeed(); int speedIndex; for(speedIndex=0;speedIndex<speedOptions.length;++speedIndex) { if( speedOptions[speedIndex] >= speed ) break; } speedNow = new JLabel(Double.toString(speedOptions[speedIndex]),JLabel.CENTER); java.awt.Dimension dim = speedNow.getPreferredSize(); dim.width = 50; speedNow.setPreferredSize(dim); CollapsiblePanel speedPanel = new CollapsiblePanel("Speed"); GridBagConstraints con2 = PanelHelper.getDefaultGridBagConstraints(); con2.weightx=0.25; speedPanel.getContentPane().add(speedNow,con2); speedControl = new JSlider(0,speedOptions.length-1,speedIndex); speedControl.addChangeListener(this); speedControl.setMajorTickSpacing(speedOptions.length-1); speedControl.setMinorTickSpacing(1); speedControl.setPaintTicks(true); con2.anchor=GridBagConstraints.NORTHEAST; con2.fill=GridBagConstraints.HORIZONTAL; con2.weightx=0.75; con2.gridx=1; speedPanel.getContentPane().add(speedControl,con2); return speedPanel; }
Example 10
Source File: SpideeControlPanel.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
private CollapsiblePanel createSpeedPanel() { CollapsiblePanel speedPanel = new CollapsiblePanel("Speed"); GridBagConstraints con2 = PanelHelper.getDefaultGridBagConstraints(); con2.weighty=1; con2.weightx=0.25; double speed=robot.speed_scale; int speedIndex; for(speedIndex=0;speedIndex<speedOptions.length;++speedIndex) { if( speedOptions[speedIndex] >= speed ) break; } speedNow = new JLabel(Double.toString(speedOptions[speedIndex]),JLabel.CENTER); java.awt.Dimension dim = speedNow.getPreferredSize(); dim.width = 50; speedNow.setPreferredSize(dim); speedPanel.getContentPane().add(speedNow,con2); speedControl = new JSlider(0,speedOptions.length-1,speedIndex); speedControl.addChangeListener(this); speedControl.setMajorTickSpacing(speedOptions.length-1); speedControl.setMinorTickSpacing(1); speedControl.setPaintTicks(true); con2.anchor=GridBagConstraints.NORTHEAST; con2.fill=GridBagConstraints.HORIZONTAL; con2.weightx=0.75; con2.gridx=1; speedPanel.getContentPane().add(speedControl,con2); return speedPanel; }
Example 11
Source File: ChromaKey.java From marvinproject with GNU Lesser General Public License v3.0 | 5 votes |
private void loadGUI(){ setTitle("Chroma Key Sample"); panelBottom = new JPanel(); ButtonHandler l_buttonHandler = new ButtonHandler(); buttonCaptureBackground = new JButton("Capture Background"); buttonStart = new JButton("Start"); buttonStart.setEnabled(false); buttonCaptureBackground.addActionListener(l_buttonHandler); buttonStart.addActionListener(l_buttonHandler); sliderColorRange = new JSlider(JSlider.HORIZONTAL, 0, 50, 30); sliderColorRange.setMinorTickSpacing(1); sliderColorRange.setPaintTicks(true); sliderColorRange.addChangeListener(new SliderHandler()); labelColorRange = new JLabel("Color Range"); panelSlider = new JPanel(); panelSlider.add(labelColorRange); panelSlider.add(sliderColorRange); panelBottom.add(buttonCaptureBackground); panelBottom.add(buttonStart); Container l_container = getContentPane(); l_container.setLayout(new BorderLayout()); l_container.add(videoPanel, BorderLayout.NORTH); l_container.add(panelSlider, BorderLayout.CENTER); l_container.add(panelBottom, BorderLayout.SOUTH); setSize(videoInterface.getImageWidth(),videoInterface.getImageHeight()+100); setVisible(true); }
Example 12
Source File: LoadSpeedSimulationPanel.java From blog with Apache License 2.0 | 5 votes |
public LoadSpeedSimulationPanel() { setLayout(null); loadPersonsSpeedModel.setMinimum(0); loadPersonsSpeedModel.setMaximum(MAX_LOAD_SPEED_MS); loadPersonsSpeedModel.setValue(INITIAL_LOAD_SPEED_MS); loadPersonsSpeedModel.setExtent(0); JSlider loadSpeedSlider = new JSlider(); loadSpeedSlider.setMinorTickSpacing(MIN_LOAD_SPEED_TICK_MS); loadSpeedSlider.setSnapToTicks(true); loadSpeedSlider.setPaintTicks(true); loadSpeedSlider.setPaintLabels(true); loadSpeedSlider.setBounds(161, 12, 429, 43); loadSpeedSlider.setModel(loadPersonsSpeedModel); add(loadSpeedSlider); JLabelTextComponent selectedLoadSpeed = new JLabelTextComponent(""); selectedLoadSpeed.setFont(new Font("Tahoma", Font.PLAIN, 12)); selectedLoadSpeed.setBounds(10, 38, 138, 14); add(selectedLoadSpeed); // adapt the jLabel to the Document model to support MVC. MessageFormat speedLabelFormat = new MessageFormat( SIMULATION_SPEED_FORMAT); Document loadSpeedDocument = selectedLoadSpeed.getDocument(); BoundedRangeModel2DocumentAdapter boundedRangeAdapter = new BoundedRangeModel2DocumentAdapter( loadSpeedDocument, speedLabelFormat); boundedRangeAdapter.bind(loadPersonsSpeedModel); JLabel label = new JLabel("Load Speed Simulation"); label.setFont(new Font("Tahoma", Font.PLAIN, 12)); label.setBounds(10, 11, 138, 14); add(label); setPreferredSize(new Dimension(600, 60)); }
Example 13
Source File: SimpleMotionDetection.java From marvinproject with GNU Lesser General Public License v3.0 | 5 votes |
private void loadGUI(){ setTitle("Simple Motion Detection"); labelMotion = new JLabel("MOTION: NO"); labelMotion.setOpaque(true); labelMotion.setHorizontalAlignment(SwingConstants.CENTER); labelMotion.setBackground(Color.red); labelMotion.setForeground(Color.white); labelSlider = new JLabel("Sensibility:"); sliderSensibility = new JSlider(JSlider.HORIZONTAL, 0, 13, 10); sliderSensibility.setMinorTickSpacing(1); sliderSensibility.setPaintTicks(true); sliderSensibility.addChangeListener(new SliderHandler()); panelCenter = new JPanel(new BorderLayout()); panelCenter.add(videoPanel, BorderLayout.NORTH); panelCenter.add(labelMotion, BorderLayout.SOUTH); panelSlider = new JPanel(); panelSlider.add(labelSlider); panelSlider.add(sliderSensibility); Container l_container = getContentPane(); l_container.add(videoPanel, BorderLayout.NORTH); l_container.add(labelMotion, BorderLayout.CENTER); l_container.add(panelSlider, BorderLayout.SOUTH); setSize(imageWidth,imageHeight+100); setVisible(true); }
Example 14
Source File: JComponentBuilders.java From visualvm with GNU General Public License v2.0 | 5 votes |
protected void setupInstance(JSlider instance) { super.setupInstance(instance); instance.setPaintTicks(paintTicks); instance.setPaintTrack(paintTrack); instance.setPaintLabels(paintLabels); instance.setInverted(isInverted); if (sliderModel != null) instance.setModel(sliderModel.createInstance()); instance.setMajorTickSpacing(majorTickSpacing); instance.setMinorTickSpacing(minorTickSpacing); instance.setSnapToTicks(snapToTicks); }
Example 15
Source File: JComponentBuilders.java From netbeans with Apache License 2.0 | 5 votes |
protected void setupInstance(JSlider instance) { super.setupInstance(instance); instance.setPaintTicks(paintTicks); instance.setPaintTrack(paintTrack); instance.setPaintLabels(paintLabels); instance.setInverted(isInverted); if (sliderModel != null) instance.setModel(sliderModel.createInstance()); instance.setMajorTickSpacing(majorTickSpacing); instance.setMinorTickSpacing(minorTickSpacing); instance.setSnapToTicks(snapToTicks); }
Example 16
Source File: ColorPick.java From Spark with Apache License 2.0 | 4 votes |
/** * Creates a Colorpicker with initial values 0,0,0,0 * * @param opacity * , true if Opacity Slider should be visible */ public ColorPick(boolean opacity) { this.setLayout(new GridBagLayout()); JLabel red = new JLabel(Res.getString("lookandfeel.color.red")); JLabel green = new JLabel(Res.getString("lookandfeel.color.green")); JLabel blue = new JLabel(Res.getString("lookandfeel.color.blue")); JLabel opaq = new JLabel(Res.getString("lookandfeel.color.opacity")); JSlider redslider = new JSlider(0,255); JSlider greenslider = new JSlider(0,255); JSlider blueslider = new JSlider(0,255); JSlider opaqslider = new JSlider(0,255); _sliderarray = new JSlider[4]; _sliderarray[0] = redslider; _sliderarray[1] = greenslider; _sliderarray[2] = blueslider; _sliderarray[3] = opaqslider; for(JSlider s : _sliderarray) { s.addChangeListener(this); s.setMajorTickSpacing(256/3); s.setMinorTickSpacing(0); s.setPaintTicks(true); s.setPaintLabels(true); } _preview = new JLabel(" "); _preview.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); _preview.setOpaque(true); this.add(red,new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(redslider,new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(green,new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(greenslider,new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(blue,new GridBagConstraints(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(blueslider,new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); if(opacity) { this.add(opaq,new GridBagConstraints(0, 3, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); this.add(opaqslider,new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); } this.add(_preview,new GridBagConstraints(2, 0, 1, 4, 0.1, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0)); }
Example 17
Source File: ResearchTechPanel.java From Open-Realms-of-Stars with GNU General Public License v2.0 | 4 votes |
/** * Create Research Tech panel with - and + buttons and up arrow to * upgrade tech level. * @param actionMinus ActionCommand for minus button * @param actionPlus ActionCommand for plus button * @param iconName Icon name to show * @param text Text for tech focus label * @param text2 Text for tech level label * @param actionUpgrade ActionCommand for upgrade button * @param sliderValue slider value * @param actionSlider slider action command * @param listener Action Listener */ public ResearchTechPanel(final String actionMinus, final String actionPlus, final String iconName, final String text, final String text2, final String actionUpgrade, final int sliderValue, final String actionSlider, final ActionListener listener) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); btnMinus = new IconButton(Icons.getIconByName(Icons.ICON_MINUS), Icons.getIconByName(Icons.ICON_MINUS_PRESSED), false, actionMinus, this); btnMinus.addActionListener(listener); this.add(Box.createRigidArea(new Dimension(5, 5))); this.add(btnMinus); SpaceGreyPanel panel = new SpaceGreyPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); label = new IconLabel(null, Icons.getIconByName(iconName), text); panel.add(label); slider = new JSlider(0, 100, sliderValue); slider.setMinorTickSpacing(4); slider.setMajorTickSpacing(20); slider.setPaintTicks(true); slider.setSnapToTicks(true); slider.setBackground(GuiStatics.COLOR_GREYBLUE); slider.setForeground(GuiStatics.COLOR_COOL_SPACE_BLUE); slider.addKeyListener(null); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { if (e.getSource() instanceof JSlider) { JSlider slide = (JSlider) e.getSource(); if (slide.getValue() % 4 == 0) { listener.actionPerformed(new ActionEvent(e, 0, actionSlider)); } } } }); panel.add(slider); lvlLabel = new IconLabel(null, Icons.getIconByName(Icons.ICON_EMPTY), text2); panel.add(lvlLabel); this.add(panel); btnUpgrade = new IconButton(Icons.getIconByName(Icons.ICON_ARROWUP), Icons.getIconByName(Icons.ICON_ARROWUP_PRESSED), false, actionUpgrade, this); btnUpgrade.setDisabledImage( Icons.getIconByName(Icons.ICON_ARROWUP_DISABLED).getIcon()); btnUpgrade.addActionListener(listener); btnUpgrade.setEnabled(false); this.add(btnUpgrade); btnPlus = new IconButton(Icons.getIconByName(Icons.ICON_PLUS), Icons.getIconByName(Icons.ICON_PLUS_PRESSED), false, actionPlus, this); btnPlus.addActionListener(listener); this.add(btnPlus); this.add(Box.createRigidArea(new Dimension(5, 5))); }
Example 18
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private JPanel createSettingsPanel(BindingContext bindingContext) { final JLabel datasetLabel = new JLabel("Dataset: "); final JComboBox<MetadataElement> datasetBox = new JComboBox<>(); datasetBox.setRenderer(new ProductNodeListCellRenderer()); JLabel recordLabel = new JLabel("Record: "); recordValueField = new JTextField(7); recordSlider = new JSlider(SwingConstants.HORIZONTAL, 1, 1, 1); recordSlider.setPaintTrack(true); recordSlider.setPaintTicks(true); recordSlider.setPaintLabels(true); configureSilderLabels(recordSlider); JLabel numRecordsLabel = new JLabel("Records / Plot: "); numRecSpinnerModel = new SpinnerNumberModel(1, 1, 1, 1); JSpinner numRecordsSpinner = new JSpinner(numRecSpinnerModel); numRecordsSpinner.setEditor(new JSpinner.NumberEditor(numRecordsSpinner, "#")); final JLabel xFieldLabel = new JLabel("X Field: "); final JComboBox<MetadataAttribute> xFieldBox = new JComboBox<>(); xFieldBox.setRenderer(new ProductNodeListCellRenderer()); final JLabel y1FieldLabel = new JLabel("Y Field: "); final JComboBox<MetadataAttribute> y1FieldBox = new JComboBox<>(); y1FieldBox.setRenderer(new ProductNodeListCellRenderer()); final JLabel y2FieldLabel = new JLabel("Y2 Field: "); final JComboBox<MetadataAttribute> y2FieldBox = new JComboBox<>(); y2FieldBox.setRenderer(new ProductNodeListCellRenderer()); bindingContext.bind(PROP_NAME_METADATA_ELEMENT, datasetBox); bindingContext.bind(PROP_NAME_RECORD_START_INDEX, recordValueField); bindingContext.bind(PROP_NAME_RECORD_START_INDEX, new SliderAdapter(recordSlider)); bindingContext.bind(PROP_NAME_RECORDS_PER_PLOT, numRecordsSpinner); bindingContext.bind(PROP_NAME_FIELD_X, xFieldBox); bindingContext.bind(PROP_NAME_FIELD_Y1, y1FieldBox); bindingContext.bind(PROP_NAME_FIELD_Y2, y2FieldBox); TableLayout layout = new TableLayout(3); JPanel plotSettingsPanel = new JPanel(layout); layout.setTableWeightX(0.0); layout.setTableAnchor(TableLayout.Anchor.NORTHWEST); layout.setTableFill(TableLayout.Fill.HORIZONTAL); layout.setTablePadding(4, 4); layout.setCellWeightX(0, 1, 1.0); layout.setCellColspan(0, 1, 2); plotSettingsPanel.add(datasetLabel); plotSettingsPanel.add(datasetBox); layout.setCellWeightX(1, 1, 0.2); layout.setCellWeightX(1, 2, 0.8); plotSettingsPanel.add(recordLabel); plotSettingsPanel.add(recordValueField); plotSettingsPanel.add(recordSlider); layout.setCellWeightX(2, 1, 1.0); layout.setCellColspan(2, 1, 2); plotSettingsPanel.add(numRecordsLabel); plotSettingsPanel.add(numRecordsSpinner); layout.setCellWeightX(3, 1, 1.0); layout.setCellColspan(3, 1, 2); plotSettingsPanel.add(xFieldLabel); plotSettingsPanel.add(xFieldBox); layout.setCellWeightX(4, 1, 1.0); layout.setCellColspan(4, 1, 2); plotSettingsPanel.add(y1FieldLabel); plotSettingsPanel.add(y1FieldBox); layout.setCellWeightX(5, 1, 1.0); layout.setCellColspan(5, 1, 2); plotSettingsPanel.add(y2FieldLabel); plotSettingsPanel.add(y2FieldBox); updateSettings(); updateUiState(); return plotSettingsPanel; }
Example 19
Source File: DeobfuscationDialog.java From jpexs-decompiler with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") public DeobfuscationDialog() { setDefaultCloseOperation(HIDE_ON_CLOSE); setSize(new Dimension(330, 270)); setTitle(translate("dialog.title")); Container cp = getContentPane(); cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS)); codeProcessingLevel = new JSlider(JSlider.VERTICAL, 1, 3, 3); codeProcessingLevel.setMajorTickSpacing(1); codeProcessingLevel.setPaintTicks(true); codeProcessingLevel.setMinorTickSpacing(1); codeProcessingLevel.setSnapToTicks(true); JLabel lab1 = new JLabel(translate("deobfuscation.level")); //lab1.setBounds(30, 0, getWidth() - 60, 25); lab1.setAlignmentX(0.5f); cp.add(lab1); Hashtable<Integer, JLabel> labelTable = new Hashtable<>(); //labelTable.put(LEVEL_NONE, new JLabel("None")); labelTable.put(DeobfuscationLevel.LEVEL_REMOVE_DEAD_CODE.getLevel(), new JLabel(translate("deobfuscation.removedeadcode"))); labelTable.put(DeobfuscationLevel.LEVEL_REMOVE_TRAPS.getLevel(), new JLabel(translate("deobfuscation.removetraps"))); labelTable.put(DeobfuscationLevel.LEVEL_RESTORE_CONTROL_FLOW.getLevel(), new JLabel(translate("deobfuscation.restorecontrolflow"))); codeProcessingLevel.setLabelTable(labelTable); codeProcessingLevel.setPaintLabels(true); codeProcessingLevel.setAlignmentX(Component.CENTER_ALIGNMENT); //codeProcessingLevel.setSize(300, 200); //codeProcessingLevel.setBounds(30, 25, getWidth() - 60, 125); codeProcessingLevel.setAlignmentX(0.5f); add(codeProcessingLevel); //processAllCheckbox.setBounds(50, 150, getWidth() - 100, 25); processAllCheckbox.setAlignmentX(0.5f); add(processAllCheckbox); processAllCheckbox.setSelected(true); JButton cancelButton = new JButton(translate("button.cancel")); cancelButton.addActionListener(this::cancelButtonActionPerformed); JButton okButton = new JButton(translate("button.ok")); okButton.addActionListener(this::okButtonActionPerformed); JPanel buttonsPanel = new JPanel(new FlowLayout()); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); buttonsPanel.setAlignmentX(0.5f); cp.add(buttonsPanel); setModal(true); View.centerScreen(this); setIconImage(View.loadImage("deobfuscate16")); }
Example 20
Source File: Sliders.java From dctb-utfpr-2018-1 with Apache License 2.0 | 4 votes |
public static void main(String[] args) { // Create and set up a frame window JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Slider with change listener"); frame.setSize(500, 500); frame.setLayout(new GridLayout(3, 1)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Set the panel to add buttons JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); // Add status label to show the status of the slider JLabel status = new JLabel("Slide the slider and you can get its value", JLabel.CENTER); // Set the slider JSlider slider = new JSlider(); slider.setMinorTickSpacing(10); slider.setPaintTicks(true); // Set the labels to be painted on the slider slider.setPaintLabels(true); // Add positions label in the slider Hashtable<Integer, JLabel> position = new Hashtable<Integer, JLabel>(); position.put(0, new JLabel("0")); position.put(50, new JLabel("50")); position.put(100, new JLabel("100")); // Set the label to be drawn slider.setLabelTable(position); // Add change listener to the slider slider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { status.setText("Value of the slider is: " + ((JSlider)e.getSource()).getValue()); } }); // Add the slider to the panel panel1.add(slider); // Set the window to be visible as the default to be false frame.add(panel1); frame.add(status); frame.add(panel2); frame.pack(); frame.setVisible(true); }