Java Code Examples for javax.swing.JSlider#setMinorTickSpacing()
The following examples show how to use
javax.swing.JSlider#setMinorTickSpacing() .
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: SimulateControlPanel.java From VanetSim with GNU General Public License v3.0 | 7 votes |
/** * Creates a slider for zooming. * * @return a ready-to-use <code>JSlider</code> */ private JSlider getZoomSlider() { JSlider slider = new JSlider(-75, 212, 1); Hashtable<Integer,JLabel> ht = new Hashtable<Integer,JLabel>(); // the labels correspond to a exponential scale but internally the slider calculates only in a constant scale => need to convert in stateChanged()! ht.put(-75, new JLabel("3km")); //$NON-NLS-1$ ht.put(-20, new JLabel("1km")); //$NON-NLS-1$ ht.put(45, new JLabel("200m")); //$NON-NLS-1$ ht.put(96, new JLabel("100m")); //$NON-NLS-1$ ht.put(157, new JLabel("30m")); //$NON-NLS-1$ ht.put(212, new JLabel("10m")); //$NON-NLS-1$ slider.setLabelTable(ht); slider.setPaintLabels(true); slider.setMinorTickSpacing(10); slider.setMajorTickSpacing(40); //slider.setPaintTicks(true); slider.addChangeListener(this); return slider; }
Example 2
Source File: ViewElementColor.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
private JSlider addField(float value,JPanel parent,String labelName,GridBagConstraints gbc) { JSlider field = new JSlider(); field.setMaximum(255); field.setMinimum(0); field.setMinorTickSpacing(1); field.setValue((int)(value*255)); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(labelName,JLabel.LEADING); JPanel panel = new JPanel(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.LINE_END); parent.add(panel,gbc); return field; }
Example 3
Source File: ViewElementSlider.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public ViewElementSlider(RobotOverlord ro,IntEntity e,int top,int bottom) { super(ro); this.e=e; e.addObserver(this); field = new JSlider(); field.setMaximum(top); field.setMinimum(bottom); field.setMinorTickSpacing(1); field.setValue(e.get()); field.addChangeListener(this); field.addFocusListener(this); JLabel label = new JLabel(e.getName(),JLabel.LEADING); value = new JLabel(Integer.toString(field.getValue()),JLabel.RIGHT); Dimension dim = new Dimension(30,1); value.setMinimumSize(dim); value.setPreferredSize(dim); value.setMaximumSize(dim); panel.setLayout(new BorderLayout()); panel.add(label,BorderLayout.LINE_START); panel.add(field,BorderLayout.CENTER); panel.add(value,BorderLayout.LINE_END); }
Example 4
Source File: ChartPanel.java From javamelody with Apache License 2.0 | 6 votes |
private JSlider createSlider() { final JSlider slider = new JSlider(); slider.setOpaque(false); slider.setMinimum(10); slider.setMaximum(200); slider.setValue(100); slider.setLabelTable(slider.createStandardLabels(50)); slider.setMajorTickSpacing(100); slider.setMinorTickSpacing(10); slider.setExtent(20); // slider.setPaintLabels(true); // slider.setPaintTicks(true); // slider.setSnapToTicks(true); slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { final int value = slider.getValue(); refreshZoom(value); } }); return slider; }
Example 5
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 6
Source File: TrackingGameBalls.java From marvinproject with GNU Lesser General Public License v3.0 | 6 votes |
private void loadGUI(){ setTitle("Video Sample - Tracking Game"); 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); buttonStart = new JButton("Start"); buttonStart.addActionListener(new ButtonHandler()); Container l_container = getContentPane(); l_container.setLayout(new BorderLayout()); l_container.add(videoPanel, BorderLayout.NORTH); l_container.add(panelSlider, BorderLayout.CENTER); l_container.add(buttonStart, BorderLayout.SOUTH); setSize(imageWidth+20,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: DoubleLabeledSlider.java From binnavi with Apache License 2.0 | 6 votes |
public DoubleLabeledSlider(final String leftText, final String rightText, final int min, final int max) { setLayout(new BorderLayout()); final JLabel leftLabel = new JLabel(leftText); m_slider = new JSlider(min, max); m_slider.setMinorTickSpacing(1); m_slider.setPaintTicks(true); m_slider.setPaintLabels(true); final JLabel rightLabel = new JLabel(rightText); add(leftLabel, BorderLayout.WEST); add(m_slider); add(rightLabel, BorderLayout.EAST); }
Example 9
Source File: ZoomSliderPanel.java From mars-sim with GNU General Public License v3.0 | 5 votes |
private JSlider getControl() { JSlider slider = new JSlider(JSlider.HORIZONTAL, 50, 200, 100); slider.setMajorTickSpacing(50); slider.setMinorTickSpacing(10); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.addChangeListener(this); return slider; }
Example 10
Source File: RotaryStewartPlatformPanel.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 11
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 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: 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 14
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 15
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 16
Source File: GameToolbar.java From SproutLife with MIT License | 4 votes |
/** * Create the panel. */ public void buildPanel() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); horizontalStrut = Box.createHorizontalStrut(20); add(horizontalStrut); JLabel lblZoom = new JLabel("Zoom"); add(lblZoom); //lblZoom.setMinimumSize(new Dimension(100, 14)); zoomSlider = new JSlider(); zoomSlider.setPreferredSize(new Dimension(100, 29)); add(zoomSlider); zoomSlider.setMinorTickSpacing(1); zoomSlider.setMinimum(-5); zoomSlider.setValue(-2); zoomSlider.setMaximum(5); JLabel speedLabel = new JLabel("Speed"); add(speedLabel); speedSlider = new JSlider(); speedSlider.setPreferredSize(new Dimension(100, 29)); speedSlider.setSnapToTicks(true); add(speedSlider); speedSlider.setMinimum(-5); speedSlider.setMaximum(4); speedSlider.setValue(-2); gifStopRecordingButton = new JButton("GIF - Stop Rec."); gifStopRecordingButton.setVisible(false); add(gifStopRecordingButton); startPauseButton = new JButton("Start"); add(startPauseButton); startPauseButton.setMaximumSize(new Dimension(200, 23)); startPauseButton.setPreferredSize(new Dimension(80, 29)); stepButton = new JButton("Step"); stepButton.setPreferredSize(new Dimension(80, 29)); add(stepButton); resetButton = new JButton("Reset"); resetButton.setPreferredSize(new Dimension(80, 29)); add(resetButton); horizontalStrut_1 = Box.createHorizontalStrut(20); add(horizontalStrut_1); }
Example 17
Source File: MainWindow.java From Creatures with GNU General Public License v2.0 | 4 votes |
private void initUI(WorldView view) { JPanel rightContainer = new JPanel(); rightContainer.setLayout(new BoxLayout(rightContainer, BoxLayout.PAGE_AXIS)); textLabel = new JLabel("Creatures"); textLabel.setAlignmentX(Component.LEFT_ALIGNMENT); speedLabel = new JLabel("Speed"); speedLabel.setAlignmentX(Component.LEFT_ALIGNMENT); speedSlider = new JSlider(0, 15, 1); speedSlider.setAlignmentX(Component.LEFT_ALIGNMENT); speedSlider.setMajorTickSpacing(5); speedSlider.setMinorTickSpacing(1); speedSlider.setSnapToTicks(true); speedSlider.setPaintLabels(true); speedSlider.setPaintTicks(true); speedSlider.addChangeListener(this); JPanel maxFoodContainer = new JPanel(); maxFoodContainer.setLayout(new FlowLayout(FlowLayout.LEFT)); maxFoodContainer.setAlignmentX(Component.LEFT_ALIGNMENT); maxFoodLabel = new JLabel("Max Food"); SpinnerModel maxFoodSpinnerModel = new SpinnerNumberModel(WorldModel.maxFoodAmount, 0, 100000, 1); maxFoodSpinner = new JSpinner(maxFoodSpinnerModel); maxFoodSpinner.setEditor(new JSpinner.NumberEditor(maxFoodSpinner, "#")); maxFoodSpinner.addChangeListener(this); maxFoodContainer.add(maxFoodLabel); maxFoodContainer.add(maxFoodSpinner); rightContainer.add(textLabel); rightContainer.add(Box.createVerticalStrut(10)); rightContainer.add(speedLabel); rightContainer.add(speedSlider); rightContainer.add(maxFoodContainer); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, view, rightContainer); splitPane.setResizeWeight(0.8); add(splitPane); menuBar = new JMenuBar(); fileMenu = new JMenu("File"); exportStatisticsItem = new JMenuItem("Export Statistics"); exportStatisticsItem.addActionListener(this); closeItem = new JMenuItem("Close"); closeItem.addActionListener(this); fileMenu.add(exportStatisticsItem); fileMenu.addSeparator(); fileMenu.add(closeItem); worldMenu = new JMenu("Creation"); createWorldItem = new JMenuItem("Create World"); createWorldItem.addActionListener(this); worldMenu.add(createWorldItem); worldMenu.addSeparator(); createCreatureItem = new JMenuItem("Create Creature"); createCreatureItem.addActionListener(this); worldMenu.add(createCreatureItem); createCreaturesItem = new JMenuItem("Create Creatures"); createCreaturesItem.addActionListener(this); worldMenu.add(createCreaturesItem); statisticsMenu = new JMenu("Statistics"); showStatisticsItem = new JMenuItem("Show Statistics"); showStatisticsItem.addActionListener(this); statisticsMenu.add(showStatisticsItem); menuBar.add(fileMenu); menuBar.add(worldMenu); menuBar.add(statisticsMenu); setJMenuBar(menuBar); }
Example 18
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 19
Source File: SpaceSliderPanel.java From Open-Realms-of-Stars with GNU General Public License v2.0 | 4 votes |
/** * Create space slider panel with - and + buttons and label * @param actionMinus ActionCommand for minus button * @param actionPlus ActionCommand for plus button * @param iconName Icon name to show * @param text Text for label * @param minValue Minimum value in slider * @param maxValue Maximum value in slider * @param sliderValue slider value * @param actionSlider slider action command * @param listener Action Listener */ public SpaceSliderPanel(final String actionMinus, final String actionPlus, final String iconName, final String text, final int minValue, final int maxValue, 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(minValue, maxValue, sliderValue); slider.setMinorTickSpacing(1); slider.setMajorTickSpacing(10); 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() % slide.getMinorTickSpacing() == 0) { listener.actionPerformed(new ActionEvent(e, 0, actionSlider)); } } } }); panel.add(slider); this.add(panel); 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 20
Source File: AmountPanel.java From testing-cin with MIT License | 4 votes |
/** * Constructor. */ public AmountPanel() { setBackground(UIConstants.TABLE_COLOR); sliderAmounts = new HashMap<Integer, Integer>(); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); amountSlider = new JSlider(); amountSlider.setBackground(UIConstants.TABLE_COLOR); amountSlider.setMajorTickSpacing(1); amountSlider.setMinorTickSpacing(1); amountSlider.setPaintTicks(true); amountSlider.setSnapToTicks(true); amountSlider.addChangeListener(this); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(0, 0, 0, 5); add(amountSlider, gbc); amountLabel = new JLabel(" "); amountLabel.setForeground(UIConstants.TEXT_COLOR); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 2; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(5, 0, 5, 0); add(amountLabel, gbc); betRaiseButton = new JButton("Bet"); betRaiseButton.addActionListener(this); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(0, 0, 0, 0); add(betRaiseButton, gbc); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); gbc.gridx = 1; gbc.gridy = 2; gbc.gridwidth = 1; gbc.gridheight = 1; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets(0, 0, 0, 0); add(cancelButton, gbc); }