public void paint(Graphics g) { int x = s1.getValue(); int y = s2.getValue(); int z = s3.getValue(); Color c = new Color(x, y, z); setBackground(c); }
public void setSBBounds() { int graczy = DB.getCompetitors(turniej.getId()).size(); groupsSB.setMinimum(2); groupsSB.setMaximum((int) Math.ceil(graczy / 2) + 2); groupsSB.setValue(turniej.getRounds()); recalcStats(); }
public TMapMainWindow(Frame parent) { // Задаем менеджер размещения типа BorderLayout // (ориентация распологаемых объектов на панели // относительно рамки) setLayout(new BorderLayout()); // Создаем экземпляр объекта класса TDocWindow // размещаем его в центре DocWindow = new TDocWindow(parent); DocWindow.init(); DocWindow.start(); DocWindow.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); add("Center", DocWindow); DocWindow.ObjectDialog.MainWindow = (TMapMainWindowBase) this; // 15/12/04 // Проектируем горизонтальный и вертикальный скроллинг ScrollBar1 = new Scrollbar(Scrollbar.HORIZONTAL); ScrollBar1.setUnitIncrement(10); ScrollBar1.setBlockIncrement(100); ScrollBar1.setValues(0, 0, 0, 0); add("South", ScrollBar1); ScrollBar1.setEnabled(false); ScrollBar2 = new Scrollbar(Scrollbar.VERTICAL); ScrollBar2.setUnitIncrement(10); ScrollBar2.setBlockIncrement(100); ScrollBar2.setValues(0, 0, 0, 0); add("East", ScrollBar2); ScrollBar2.setEnabled(false); ScrollBar1.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); ScrollBar2.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
public void mouseDragged(MouseEvent me) { int x = me.getX(); int y = me.getY(); vertSB.setValue(y); horzSB.setValue(x); repaint(); }
// public void setPoint(T3d p){ point=p; set_values(); } private void set_values() { x_bar.setValue((int) view.camera.x / 100); y_bar.setValue((int) view.camera.y / 100); z_bar.setValue((int) view.camera.z / 100); x_text.setText("" + (int) view.camera.x / 100); y_text.setText("" + (int) view.camera.y / 100); z_text.setText("" + (int) view.camera.z / 100); }
public void adjustmentValueChanged(AdjustmentEvent e) { Object ob = e.getSource(); int p, q, r; p = s1.getValue(); q = s2.getValue(); r = s3.getValue(); Color c = new Color(p, q, r); p1.setBackground(c); }
public void mouseDragged(MouseEvent mme) { System.out.println("dragged"); int x = mme.getX(); int y = mme.getX(); int z = mme.getX(); s1.setValue(x); s2.setValue(y); s3.setValue(z); }
public void paint(Graphics g) { msg = "Vertical: " + vertSB.getValue(); msg += ", Horizontal: " + horzSB.getValue(); g.drawString(msg, 6, 160); // show current mouse drag position g.drawString("*", horzSB.getValue(), vertSB.getValue()); }
demo5() { f = new Frame(); f.setSize(300, 300); // f.setBackground(Color.red); f.setLayout(null); s1 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260); s1.setBackground(Color.red); s1.setBounds(30, 35, 20, 255); s2 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260); s2.setBackground(Color.green); s2.setBounds(60, 35, 20, 255); s3 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260); s3.setBackground(Color.blue); s3.setBounds(90, 35, 20, 255); f.add(s1); f.add(s2); f.add(s3); s1.addAdjustmentListener(this); s2.addAdjustmentListener(this); s3.addAdjustmentListener(this); p1 = new Panel(); p1.setBounds(120, 35, 170, 255); f.add(p1); f.setVisible(true); }
/** Capture des évènements des scrollbars */ public void adjustmentValueChanged(AdjustmentEvent e) { if (e.getSource().equals(sb_victoires)) { int valeur = sb_victoires.getValue(); lbl_victoires.setText("Nombre De Victoires: " + valeur); nb_victoires = valeur; } else { int valeur = sb_fps.getValue(); lbl_fps.setText("FPS: " + valeur); fps = valeur; } } // adjustmentValueChanged()
public synchronized void adjustmentValueChanged(AdjustmentEvent e) { Object source = e.getSource(); for (int i = 0; i < slider.size(); i++) { if (source == slider.elementAt(i)) { Scrollbar sb = (Scrollbar) source; TextField tf = (TextField) numberField.elementAt(sliderIndexes[i]); int digits = sliderScales[i] == 1.0 ? 0 : 2; tf.setText("" + IJ.d2s(sb.getValue() / sliderScales[i], digits)); } } }
public void SetScrollBarsValues(int[] left, int[] top) // 15/12/04 { int maxsize = ScrollBar1.getMaximum(); if (left[0] < 0) left[0] = 0; else if (left[0] > maxsize) left[0] = maxsize; ScrollBar1.setValues(left[0], 30, 0, maxsize); maxsize = ScrollBar2.getMaximum(); if (top[0] < 0) top[0] = 0; else if (top[0] > maxsize) top[0] = maxsize; ScrollBar2.setValues(top[0], 30, 0, maxsize); }
/** * Called to set the URL to browse, and reset the scrollbars. * * @param url indicates document to view. * @throws IOException if an error occures */ public void setURL(final URL url) throws IOException { final URL old = getURL(); super.setURL(url); if (old == null) { // bcr getImageWait().setBufferMode(DjVuImage.COMPLETE_BUFFER); setScrollbar(Scrollbar.HORIZONTAL, new Scrollbar(Scrollbar.HORIZONTAL)); setScrollbar(Scrollbar.VERTICAL, new Scrollbar(Scrollbar.VERTICAL)); hScroll.setUnitIncrement(16); vScroll.setUnitIncrement(16); } }
public void recalcStats() { // TODO - poprawić przewidywany czas turnieju groupsL.setText(Strings.groupsT + groupsSB.getValue()); boardsL.setText(Strings.boardsT + boardsSB.getValue()); sgTimeL.setText(Strings.sgTimeT + (sgTimeSB.getValue() / 2f) + " min"); int graczy = DB.getCompetitors(turniej.getId()).size(); if (turniej.getBoards() < 1 || graczy < 2) return; float czasSG = sgTimeSB.getValue() / 2f; int grup = groupsSB.getValue(); int rozgrywek = Simulator.rozgrywek_eliminacje(graczy, grup); stats1L.setText(Strings.gamesT + String.valueOf(rozgrywek)); int gier_naraz = (int) Math.min(Math.floor(graczy / 2), turniej.getBoards()); stats2L.setText(Strings.timeRRET + Math.ceil(rozgrywek / gier_naraz) * czasSG + " min"); }
/** * Called to process scrollbar events. * * @param event to process. */ public void adjustmentValueChanged(AdjustmentEvent event) { try { final Scrollbar hScroll = getScrollbar(Scrollbar.HORIZONTAL); final Scrollbar vScroll = getScrollbar(Scrollbar.VERTICAL); final Point scrollPosition = getScrollPosition(); setScrollPosition( (hScroll != null) ? hScroll.getValue() : scrollPosition.x, (vScroll != null) ? vScroll.getValue() : scrollPosition.y); } catch (final Throwable exp) { exp.printStackTrace(DjVuOptions.err); System.gc(); } }
public void adjustmentValueChanged(AdjustmentEvent event) { if (event.getSource() == SBrecpos) { if (event.getAdjustmentType() == AdjustmentEvent.TRACK) { goTo(SBrecpos.getValue()); return; } if (event.getID() == AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED) { SBrecpos.setEnabled(false); goTo(SBrecpos.getValue()); SBrecpos.setEnabled(true); } } }
public void adjustmentValueChanged(AdjustmentEvent evt) { // chamado quando o usu�rio modifica o valor de uma das // barras de rolagem int r = redScroll.getValue(); int g = greenScroll.getValue(); int b = blueScroll.getValue(); redLabel.setText(" R = " + r); greenLabel.setText(" G = " + g); blueLabel.setText(" B = " + b); colorCanvas.setBackground(new Color(r, g, b)); colorCanvas.repaint(); // Redraw the canvas in its new color. } // end adjustmentValueChanged
public void init() { s1 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255); s2 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 5, 0, 255); s3 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 10, 0, 255); add(s1); add(s2); add(s3); s1.addAdjustmentListener(this); s2.addAdjustmentListener(this); s3.addAdjustmentListener(this); addMouseMotionListener(this); /* s1.addMouseMotionListener(this); s2.addMouseMotionListener(this); s3.addMouseMotionListener(this);*/ }
private void updateFromField() { try { double v = 0.0; if (integral) { v = (double) (Integer.parseInt(field.getText())); } else { v = (new Double(field.getText())).doubleValue(); } if (v < min) { v = min; field.setText(ftoa(v)); } else if (v > max) { v = max; field.setText(ftoa(v)); } scroll.setValue(getSlideLoc(v)); val = v; value_changed.notify(new Double(v)); } catch (NumberFormatException nfe) { field.setText(ftoa(val)); } }
private void updateFromSlider() { double v = getValue(scroll.getValue()); field.setText(ftoa(v)); val = v; value_changed.notify(new Double(val)); }
public Slider(String name, double init, double min, double max) { this.val = init; this.min = min; this.max = max; this.integral = false; this.name = new Label(name); this.field = new TextField(ftoa(init), 7); this.scroll = new Scrollbar(Scrollbar.HORIZONTAL, getSlideLoc(init), 1, 0, 257); this.value_changed = new Signal(); scroll.addAdjustmentListener( new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent ae) { updateFromSlider(); } }); field.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { updateFromField(); } }); }
void adjustMinBri(int value) { minBri = value; if (maxBri < minBri) { maxBri = minBri; maxSlider3.setValue((int) maxBri); } }
void adjustMaxHue(int value) { maxHue = value; if (minHue > maxHue) { minHue = maxHue; minSlider.setValue((int) minHue); } }
void adjustMaxBri(int value) { maxBri = value; if (minBri > maxBri) { minBri = maxBri; minSlider3.setValue((int) minBri); } }
void adjustMaxSat(int value) { maxSat = value; if (minSat > maxSat) { minSat = maxSat; minSlider2.setValue((int) minSat); } }
public CollageList() { super(); actionComponent = new Button(); Panel toolBar; setLayout(new BorderLayout()); // ggHScroll = new Scrollbar( Scrollbar.HORIZONTAL, 0, 0x8000, 0, 0x8000 ); ggVScroll = new Scrollbar(Scrollbar.VERTICAL, 0, 0x8000, 0, 0x8000); // ggHScroll.addAdjustmentListener( ggCurve ); ggVScroll.addAdjustmentListener(this); toolBar = new Panel(); toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2)); ggAdd = new JButton(" Add "); ggDel = new JButton(" Delete "); ggDup = new JButton(" Duplicate "); ggAdd.addActionListener(this); ggDel.addActionListener(this); ggDup.addActionListener(this); toolBar.add(ggAdd); toolBar.add(ggDel); toolBar.add(ggDup); add(toolBar, BorderLayout.NORTH); // add( ggHScroll, BorderLayout.SOUTH ); add(ggVScroll, BorderLayout.EAST); add(new CollageCanvas(this), BorderLayout.CENTER); // add( ggCurve, BorderLayout.CENTER ); }
void adjustMinSat(int value) { minSat = value; if (maxSat < minSat) { maxSat = minSat; maxSlider2.setValue((int) maxSat); } }
void adjustMinHue(int value) { minHue = value; if (maxHue < minHue) { maxHue = minHue; maxSlider.setValue((int) maxHue); } }
public void textValueChanged(TextEvent e) { notifyListeners(e); if (slider == null) return; Object source = e.getSource(); for (int i = 0; i < slider.size(); i++) { int index = sliderIndexes[i]; if (source == numberField.elementAt(index)) { TextField tf = (TextField) numberField.elementAt(index); double value = Tools.parseDouble(tf.getText()); if (!Double.isNaN(value)) { Scrollbar sb = (Scrollbar) slider.elementAt(i); sb.setValue((int) (value * sliderScales[i])); } // IJ.log(i+" "+tf.getText()); } } }
public void init() { int width = Integer.parseInt(getParameter("width")); int height = Integer.parseInt(getParameter("height")); vertSB = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, height); horzSB = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, width); add(vertSB); add(horzSB); // register to receive adjustment events vertSB.addAdjustmentListener(this); horzSB.addAdjustmentListener(this); addMouseMotionListener(this); }