javax.swing.JScrollPane.<init>()方法的使用及代码示例

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

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

JScrollPane.<init>介绍

暂无

代码示例

代码示例来源:origin: alibaba/druid

/**
 * 将各个界面添加到JFrame中
 * 
 * @param pane JFrame内部的Container对象
 */
private void addComponentsToPane(Container pane) {
  JScrollPane scrollPane = new JScrollPane();
  JPanel contentPanel = new JPanel();
  contentPanel.setLayout(new GridLayout(0, 1));
  final JTextArea sqlField = new JTextArea(formatSql, 8, 20);
  final JScrollPane content1 = new JScrollPane(sqlField);
  content1.setBorder((TitledBorder) BorderFactory.createTitledBorder("SQL语句"));
  contentPanel.add(content1);
  addTable(contentPanel, "解析信息", parseData);
  addTable(contentPanel, "上次慢查询信息", lastSlowData);
  addTable(contentPanel, "上次错误查询信息", lastErrorData);
  addTable(contentPanel, "其他信息", otherData);
  scrollPane.setViewportView(contentPanel);
  pane.add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: stackoverflow.com

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class Main{
  public static void main( String [] args ) throws InterruptedException  {
    JFrame frame = new JFrame();
    frame.add( new JLabel(" Outout" ), BorderLayout.NORTH );

    JTextArea ta = new JTextArea();
    TextAreaOutputStream taos = new TextAreaOutputStream( ta, 60 );
    PrintStream ps = new PrintStream( taos );
    System.setOut( ps );
    System.setErr( ps );

    frame.add( new JScrollPane( ta )  );

    frame.pack();
    frame.setVisible( true );

    for( int i = 0 ; i < 100 ; i++ ) {
      System.out.println( i );
      Thread.sleep( 500 );
    }
  }
}

代码示例来源:origin: kiegroup/optaplanner

return;
final JFrame exceptionFrame = new JFrame("Uncaught exception: " + e.getMessage());
Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon");
BufferedImage errorImage = new BufferedImage(
errorIcon.paintIcon(null, errorImage.getGraphics(), 0, 0);
exceptionFrame.setIconImage(errorImage);
exceptionFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
JPanel contentPanel = new JPanel(new BorderLayout(5, 5));
contentPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
stackTraceTextArea.setTabSize(4);
stackTraceTextArea.append(trace);
JScrollPane stackTraceScrollPane = new JScrollPane(stackTraceTextArea,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
contentPanel.add(stackTraceScrollPane, BorderLayout.CENTER);

代码示例来源:origin: igniterealtime/Smack

private void createDebug() {
  frame = new JFrame("Smack Debug Window");
  iqProvidersPanel.add(new JScrollPane(list));
  informationPanel.add(iqProvidersPanel);
  extensionProvidersPanel.add(new JScrollPane(list));
  informationPanel.add(extensionProvidersPanel);
  frame.getContentPane().add(tabbedPane);

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame("test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextArea textArea = new JTextArea(24, 80);
textArea.setFont(new Font("monospaced", Font.PLAIN, 12));
frame.add(new JScrollPane(textArea));
frame.pack();
frame.setVisible(true);

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

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}

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

cache.addChangeListener(model);
frame=new JFrame("ReplCacheDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
add(new JScrollPane(table));

代码示例来源:origin: igniterealtime/Smack

frame = new JFrame("Smack Debug Window -- " + connection.getXMPPServiceDomain() + ":" +
    connection.getPort());
sentText1.setForeground(new Color(112, 3, 3));
sentText2.setForeground(new Color(112, 3, 3));
allPane.add(new JScrollPane(sentText1));
tabbedPane.add("Sent", new JScrollPane(sentText2));
receivedText1.setForeground(new Color(6, 76, 133));
receivedText2.setForeground(new Color(6, 76, 133));
allPane.add(new JScrollPane(receivedText1));
tabbedPane.add("Received", new JScrollPane(receivedText2));
interpretedText1.setForeground(new Color(1, 94, 35));
interpretedText2.setForeground(new Color(1, 94, 35));
allPane.add(new JScrollPane(interpretedText1));
tabbedPane.add("Interpreted", new JScrollPane(interpretedText2));
menu.add(menuItem2);
frame.getContentPane().add(tabbedPane);

代码示例来源:origin: SonarSource/sonarqube

componentDetailsTab = new JScrollPane();
tabbedPane.addTab("Component details", null, componentDetailsTab, null);
sourceTab = new JScrollPane();
tabbedPane.addTab("Source", null, sourceTab, null);
highlightingTab = new JScrollPane();
tabbedPane.addTab("Highlighting", null, highlightingTab, null);
symbolTab = new JScrollPane();
tabbedPane.addTab("Symbol references", null, symbolTab, null);
coverageTab = new JScrollPane();
tabbedPane.addTab("Coverage", null, coverageTab, null);
duplicationTab = new JScrollPane();
tabbedPane.addTab("Duplications", null, duplicationTab, null);
testsTab = new JScrollPane();
tabbedPane.addTab("Tests", null, testsTab, null);
issuesTab = new JScrollPane();
tabbedPane.addTab("Issues", null, issuesTab, null);
externalIssuesTab = new JScrollPane();
tabbedPane.addTab("External Issues", null, externalIssuesTab, null);
measuresTab = new JScrollPane();
tabbedPane.addTab("Measures", null, measuresTab, null);

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

private void buildContentPanel() {
 editorPane = new JEditorPane ();
 editorPane.setContentType("text/rtf");
 editorPane.addKeyListener(new InputListener());
 //    defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes();
 StyleConstants.setFontFamily(defaultAttrSet, "Lucida Sans");
 Document doc = new DefaultStyledDocument();
 editorPane.setDocument(doc);
 try {
  doc.insertString(0, initText, defaultAttrSet);
 } catch (Exception ex) {
  throw new RuntimeException(ex);
 }
 JScrollPane scrollPane = new JScrollPane(editorPane);
 frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
 editorPane.setEditable(true);
}

代码示例来源:origin: cmusphinx/sphinx4

float windowShiftInMs = ps.getFloat(RaisedCosineWindower.PROP_WINDOW_SHIFT_MS);
final JFrame jframe = new JFrame("AudioTool");
fileChooser = new JFileChooser();
createMenuBar(jframe);
cepstrumPanel.setAlignmentX(0.0f);
JScrollPane scroller = new JScrollPane(panel);
jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jframe.setContentPane(outerPanel);
jframe.pack();

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

public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose) {
  final JFrame main = new JFrame(title);
  int mainWidth = width;
  JScrollPane scroll = new JScrollPane(this);
  scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  main.getContentPane().add(scroll, BorderLayout.CENTER);
  final CursorDisplayer glass = new CursorDisplayer();
  main.setGlassPane(glass);
    JPanel zoomPanel = new JPanel();
    zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
    main.getContentPane().add(zoomPanel, BorderLayout.WEST);
    zoomPanel.add(Box.createVerticalGlue());
    JButton zoomIn = new JButton("Zoom In");

代码示例来源:origin: stackoverflow.com

final JFrame frame = new JFrame("Nested Layout Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
plafComponents.add(plafChooser);
plafComponents.add(pack);
gui.add(plafComponents, BorderLayout.NORTH);
dynamicLabels.add( new JScrollPane(labels), BorderLayout.CENTER );
} catch(Exception continuewithNoSort) {
JScrollPane tableScroll = new JScrollPane(table);
Dimension tablePreferred = tableScroll.getPreferredSize();
tableScroll.setPreferredSize(
  JSplitPane.VERTICAL_SPLIT,
  tableScroll,
  new JScrollPane(imagePanel));
gui.add( splitPane, BorderLayout.CENTER );
frame.pack();
frame.setVisible(true);

代码示例来源:origin: 4thline/cling

@Override
  public void run() {
    errorWindow.getContentPane().removeAll();
    JTextArea textArea = new JTextArea();
    textArea.setEditable(false);
    StringBuilder text = new StringBuilder();
    text.append("An exceptional error occurred!\nYou can try to continue or exit the application.\n\n");
    text.append("Please tell us about this here:\nhttp://www.4thline.org/projects/mailinglists-cling.html\n\n");
    text.append("-------------------------------------------------------------------------------------------------------------\n\n");
    Writer stackTrace = new StringWriter();
    throwable.printStackTrace(new PrintWriter(stackTrace));
    text.append(stackTrace.toString());
    textArea.setText(text.toString());
    JScrollPane pane = new JScrollPane(textArea);
    errorWindow.getContentPane().add(pane, BorderLayout.CENTER);
    JButton exitButton = new JButton("Exit Application");
    exitButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        System.exit(1);
      }
    });
    errorWindow.getContentPane().add(exitButton, BorderLayout.SOUTH);
    errorWindow.pack();
    Application.center(errorWindow);
    textArea.setCaretPosition(0);
    errorWindow.setVisible(true);
  }
});

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
frame.add(new JScrollPane(new energon()));
frame.setSize(300, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

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

public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose) {
  final JFrame main = new JFrame(title);
  int mainWidth = width;
  JScrollPane scroll = new JScrollPane(this);
  scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  main.getContentPane().add(scroll, BorderLayout.CENTER);
  final CursorDisplayer glass = new CursorDisplayer();
  main.setGlassPane(glass);
    JPanel zoomPanel = new JPanel();
    zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
    main.getContentPane().add(zoomPanel, BorderLayout.WEST);
    zoomPanel.add(Box.createVerticalGlue());
    JButton zoomIn = new JButton("Zoom In");

代码示例来源:origin: stackoverflow.com

final JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setSize(400, 300);
frame.setVisible(true);

代码示例来源:origin: skylot/jadx

controlPane.add(cb);
JScrollPane scrollPane = new JScrollPane(textPane);
contentPane.add(controlPane, BorderLayout.PAGE_START);
contentPane.add(scrollPane, BorderLayout.CENTER);
contentPane.add(close, BorderLayout.PAGE_END);

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
frame.add(new JScrollPane(new energon()));
frame.setSize(300, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

代码示例来源:origin: stackoverflow.com

Runnable r = new Runnable() {
 public void run() {
  final JFrame f = new JFrame("Test Screenshot");
  p.add( new JScrollPane(new JTree()),
   BorderLayout.WEST );
  p.add( new JScrollPane( new JTextArea(HELP,10,30) ),
   BorderLayout.CENTER );
  f.pack();
  f.setLocationRelativeTo(null);
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setVisible(true);

相关文章

JScrollPane类方法