javax.swing.JFrame.repaint()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(212)

本文整理了Java中javax.swing.JFrame.repaint()方法的一些代码示例,展示了JFrame.repaint()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.repaint()方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:repaint

JFrame.repaint介绍

暂无

代码示例

代码示例来源:origin: kevin-wayne/algs4

/**
 * Copies offscreen buffer to onscreen buffer. There is no reason to call
 * this method unless double buffering is enabled.
 */
public void show() {
  onscreen.drawImage(offscreenImage, 0, 0, null);
  frame.repaint();
}

代码示例来源:origin: kevin-wayne/algs4

/**
 * Copies offscreen buffer to onscreen buffer. There is no reason to call
 * this method unless double buffering is enabled.
 */
public static void show() {
  onscreen.drawImage(offscreenImage, 0, 0, null);
  frame.repaint();
}

代码示例来源:origin: kevin-wayne/algs4

/**
 * Displays the picture in a window on the screen.
 */
public void show() {
  // create the GUI for viewing the image if needed
  if (frame == null) {
    frame = new JFrame();
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("File");
    menuBar.add(menu);
    JMenuItem menuItem1 = new JMenuItem(" Save...   ");
    menuItem1.addActionListener(this);
    // use getMenuShortcutKeyMaskEx() in Java 10 (getMenuShortcutKeyMask() deprecated)
    menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
                 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu.add(menuItem1);
    frame.setJMenuBar(menuBar);
    frame.setContentPane(getJLabel());
    // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    if (filename == null) frame.setTitle(width + "-by-" + height);
    else                  frame.setTitle(filename);
    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
  // draw
  frame.repaint();
}

代码示例来源:origin: kevin-wayne/algs4

/**
 * Displays the picture in a window on the screen.
 */
public void show() {
  // create the GUI for viewing the image if needed
  if (frame == null) {
    frame = new JFrame();
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("File");
    menuBar.add(menu);
    JMenuItem menuItem1 = new JMenuItem(" Save...   ");
    menuItem1.addActionListener(this);
    // use getMenuShortcutKeyMaskEx() in Java 10 (getMenuShortcutKeyMask() deprecated)           
    menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
                 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu.add(menuItem1);
    frame.setJMenuBar(menuBar);
    frame.setContentPane(getJLabel());
    // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    if (filename == null) frame.setTitle(width + "-by-" + height);
    else                  frame.setTitle(filename);
    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
  // draw
  frame.repaint();
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void showHistory() {
 if (historyFrame == null) {
  historyFrame = new JFrame("Statistics History");
 } else {
  historyFrame.setVisible(false);
  historyFrame= new JFrame("Statistics History");
 }
 historyFrame.setLayout(new GridLayout(1,0));
 Object[][] entries = new Object[historyList.size()][3];
 for(int i = 0; i < historyList.size(); i++) {
  entries[i] = historyList.get(i).toArray();
 }
 DefaultTableModel tableModel = new TregexGUITableModel(entries, HistoryEntry.columnNamesArray());
 JTable statTable = new JTable(tableModel);
 DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) statTable.getDefaultRenderer(String.class);
 dtcr.setHorizontalAlignment(DefaultTableCellRenderer.CENTER);
 JScrollPane scroller = new JScrollPane(statTable);
 historyFrame.add(scroller);
 historyFrame.pack();
 historyFrame.setLocationRelativeTo(TregexGUI.getInstance());
 historyFrame.setBackground(Color.WHITE);
 historyFrame.setVisible(true);
 historyFrame.repaint();
}

代码示例来源:origin: marytts/marytts

double[] pred = members[m].generatePolynomialValues(meanValues.length, 0, 1);
  clusterGraph.addDataSeries(pred, Color.GRAY, FunctionGraph.DRAW_LINE, -1);
  jf.repaint();
jf.repaint();

代码示例来源:origin: marytts/marytts

double[] pred = members[m].generatePolynomialValues(meanValues.length, 0, 1);
  clusterGraph.addDataSeries(pred, Color.GRAY, FunctionGraph.DRAW_LINE, -1);
  jf.repaint();
jf.repaint();

代码示例来源:origin: marytts/marytts

double[] pred = members[m].generatePolynomialValues(meanValues.length, 0, 1);
  clusterGraph.addDataSeries(pred, Color.GRAY, FunctionGraph.DRAW_LINE, -1);
  jf.repaint();
jf.repaint();

代码示例来源:origin: marytts/marytts

double[] pred = members[m].generatePolynomialValues(meanValues.length, 0, 1);
  clusterGraph.addDataSeries(pred, Color.GRAY, FunctionGraph.DRAW_LINE, -1);
  jf.repaint();
jf.repaint();

代码示例来源:origin: fossasia/neurolab-desktop

@Override
  public void mouseClicked(MouseEvent e)
  {
    playbackSpeed++;
    if (playbackSpeed>=numPlaybackModes)
      playbackSpeed = 0;
    window.repaint();
  }
});

代码示例来源:origin: marytts/marytts

String baseName = mapPolynomialBaseNames.get(members[m]);
  System.out.print(baseName + " ");
  jf.repaint();
jf.repaint();

代码示例来源:origin: marytts/marytts

String baseName = mapPolynomialBaseNames.get(members[m]);
  System.out.print(baseName + " ");
  jf.repaint();
jf.repaint();

代码示例来源:origin: fossasia/neurolab-desktop

audioFeedbackFrame.repaint();

代码示例来源:origin: RaiMan/SikuliX2

@Override
public void mouseDragged(MouseEvent e) {
 super.mouseDragged(e);
 if (!canDrag) {
  return;
 }
 String dragState = "continue";
 if (!isDragging) {
  isDragging = true;
  dragState = "start";
 }
 currentDrag = localDevice.at();
 storyTopLeft.x = currentDrag.x - dragStart.x;
 storyTopLeft.y = currentDrag.y - dragStart.y;
 frame.setLocation(storyTopLeft.x, storyTopLeft.y);
 frame.repaint();
 log.trace("%s dragging at (%d,%d) story: %s", dragState, currentDrag.x, currentDrag.y, logStoryFrame());
}

代码示例来源:origin: fossasia/neurolab-desktop

window.repaint();

代码示例来源:origin: fossasia/neurolab-desktop

public void run() {
    if (currentFeedbackSettings != null) {
      currentFeedbackSettings.updateFeedback();
      if (oscForwarder != null) {
        OSCBundle bundle = new OSCBundle();
        for (int c = 0; c < numChannels; c++) {
          for (int b = 0; b < bins; b++) {
            OSCMessage msg = new OSCMessage(textSerialPort.getText() + "/" + binLabels[b] + "/" + c);
            Object argument = new Object();
            argument = new Double(currentFeedbackSettings.getRewardFFTBins()[b][c]);
            // argument=new Float(meanFFTBins[b][c]);
            msg.addArgument(argument);
            bundle.addPacket(msg);
            oscForwarder.forwardMessage(msg);
          }
        }
      }
    }
    this.frame.repaint();
    // oscForwarder.forwardBundle(bundle);
    // focusOMeter.setCurrentFeedback(currentFeedback);
  }
}

代码示例来源:origin: fossasia/neurolab-desktop

window.repaint();

代码示例来源:origin: RaiMan/SikuliX2

@Override
 public void mouseReleased(MouseEvent e) {
  super.mouseReleased(e);
  Element loc = new Element(e.getPoint());
  log.trace("released at: (%d,%d) story: %s", loc.x, loc.y, logStoryFrame());
  activeElement = null;
  if (!isDragging) {
   if (activeElements.size() > 0) {
    for (Symbol symbol : activeElements) {
     if (symbol.contains(loc)) {
      activeElement = symbol;
     }
     log.trace("clicked active symbol: %s story: %s", getClickedSymbol(), logStoryFrame());
    }
   }
   stop();
  } else {
   currentDrag = localDevice.at();
   storyTopLeft.x = currentDrag.x - dragStart.x;
   storyTopLeft.y = currentDrag.y - dragStart.y;
   frame.setLocation(storyTopLeft.x, storyTopLeft.y);
   frame.repaint();
   log.trace("end dragging at: (%d,%d) story: %s", loc.x, loc.y, logStoryFrame());
   SX.pause(0.5);
  }
  dragStart = null;
  isDragging = false;
 }
});

代码示例来源:origin: biojava/biojava

/**
 * Set the title of the AlignmentJmol window.
 * @param label
 */
public void setTitle(String title){
  frame.setTitle(title);
  frame.repaint();
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
 public void mouseClicked(MouseEvent e) {
  frame.getLayeredPane().remove(imagePanel);
  frame.getLayeredPane().remove(backgroundPanel);
  frame.validate();
  frame.repaint();
 }
});

相关文章

JFrame类方法