本文整理了Java中javax.swing.JTextPane.<init>()
方法的一些代码示例,展示了JTextPane.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.<init>()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:<init>
暂无
代码示例来源:origin: libgdx/libgdx
JPanel leftSidePanel = new JPanel();
leftSidePanel.setLayout(new GridBagLayout());
getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
JScrollPane fontScroll = new JScrollPane();
fontPanel.add(fontScroll, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
samplePanel.setBorder(BorderFactory.createTitledBorder("Sample Text"));
JScrollPane textScroll = new JScrollPane();
samplePanel.add(textScroll, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
sampleTextPane = new JTextPane();
textScroll.setViewportView(sampleTextPane);
getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
effectsPanel.setMinimumSize(new Dimension(210, 1));
effectsScroll = new JScrollPane();
effectsPanel.add(effectsScroll, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
代码示例来源:origin: stanfordnlp/CoreNLP
dataFilePanel = new javax.swing.JPanel();
dataFileLabel = new javax.swing.JLabel();
textScrollPane = new javax.swing.JScrollPane();
textPane = new javax.swing.JTextPane();
treeContainer = new javax.swing.JPanel();
parserFilePanel = new javax.swing.JPanel();
代码示例来源:origin: stackoverflow.com
public class Main {
public static void main(String[] args) {
JTextPane textPane = new JTextPane();
StyledDocument doc = textPane.getStyledDocument();
Style style = textPane.addStyle("I'm a Style", null);
StyleConstants.setForeground(style, Color.red);
try { doc.insertString(doc.getLength(), "BLAH ",style); }
catch (BadLocationException e){}
StyleConstants.setForeground(style, Color.blue);
try { doc.insertString(doc.getLength(), "BLEH",style); }
catch (BadLocationException e){}
JFrame frame = new JFrame("Test");
frame.getContentPane().add(textPane);
frame.pack();
frame.setVisible(true);
}
}
代码示例来源:origin: stackoverflow.com
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
tPane = new JTextPane();
tPane.setBorder(eb);
topPanel.add(tPane);
appendToPane(tPane, "flow", Color.ORANGE);
getContentPane().add(topPanel);
setVisible(true);
代码示例来源:origin: stackoverflow.com
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane jtp = new JTextPane();
StyledDocument doc = (StyledDocument) jtp.getDocument();
SimpleAttributeSet normal = new SimpleAttributeSet();
代码示例来源:origin: RaiMan/SikuliX2
+ "<hr>type ESC to close";
JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
JTextPane jtp = new JTextPane();
jtp.setContentType("text/html");
jtp.setFont(new Font(Font.DIALOG, Font.PLAIN, 14));
jtp.setCaretPosition(0);
JScrollPane jsp = new JScrollPane(jtp);
jsp.setPreferredSize(new Dimension(fWidth, fHeight));
代码示例来源:origin: iTransformers/netTransformer
private void printMessageToScreen(String message) {
if(message == null || message.equals("")) {
return;
}
JFrame frame = new JFrame("IPsec Neighbours");
frame.setSize(300, 200);
frame.getContentPane().setLayout(new BorderLayout());
JTextPane text = new JTextPane();
text.setEditable(false);
text.setContentType("text/html");
text.setText(message);
frame.getContentPane().add("Center",text);
frame.setVisible(true);
}
代码示例来源:origin: stackoverflow.com
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(400, 400);
setLocationRelativeTo(null);
JTextPane txt = new JTextPane(doc);
txt.setText("public class Hi {}");
add(new JScrollPane(txt));
setVisible(true);
代码示例来源:origin: libgdx/libgdx
JPanel leftSidePanel = new JPanel();
leftSidePanel.setLayout(new GridBagLayout());
getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
JScrollPane fontScroll = new JScrollPane();
fontPanel.add(fontScroll, new GridBagConstraints(1, 1, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
samplePanel.setBorder(BorderFactory.createTitledBorder("Sample Text"));
JScrollPane textScroll = new JScrollPane();
samplePanel.add(textScroll, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
sampleTextPane = new JTextPane();
textScroll.setViewportView(sampleTextPane);
getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
effectsPanel.setMinimumSize(new Dimension(210, 1));
effectsScroll = new JScrollPane();
effectsPanel.add(effectsScroll, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0));
代码示例来源:origin: wiztools/rest-client
JTextPane jtp = new JTextPane();
jtp.setEditable(false);
jtp.setContentType("text/html");
jtp.setText(MessageI18N.getMessage("menu.help.about"));
jp_center.add(new JScrollPane(jtp));
jp.add(jp_center, BorderLayout.CENTER);
代码示例来源:origin: stackoverflow.com
public class SomeFrame
{
public static void main( String[] args )
{
JFrame frame = new JFrame( );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
JTextPane tp = new JTextPane();
JScrollPane sp = new JScrollPane(tp);
frame.getContentPane().add( sp );
frame.pack( );
frame.setVisible( true );
}
}
代码示例来源:origin: stackoverflow.com
JTextPane tp = new JTextPane();
JScrollPane js = new JScrollPane();
js.getViewport().add(tp);
JFrame jf = new JFrame();
jf.getContentPane().add(js);
jf.pack();
jf.setSize(800,800);
jf.setVisible(true);
try {
URL url = new URL("http://www.google.com");
tp.setPage(url);
}
catch (Exception e) {
e.printStackTrace();
}
代码示例来源:origin: stackoverflow.com
final JFrame frame = new JFrame();
JPanel panel = new JPanel(new BorderLayout());
JTextPane pane = new JTextPane();
pane.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
frame.pack();
}
});
panel.add(pane, BorderLayout.CENTER);
frame.setContentPane(panel);
frame.pack();
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame(TestDifferentStyles.class.getSimpleName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane textPane = new JTextPane(doc);
textPane.setText("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has "
+ "been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of "
frame.add(new JScrollPane(textPane));
frame.setSize(500, 400);
frame.setVisible(true);
代码示例来源:origin: chewiebug/GCViewer
private void initComponents(String fileName) {
super.initComponents();
JTextPane textPane = new JTextPane();
textPane.setEditable(false);
textPane.setContentType("text/html");
textPane.addHyperlinkListener(new HyperlinkAdapter(this));
try {
textPane.setText(readFile(fileName));
textPane.setCaretPosition(0);
}
catch (IOException e) {
e.printStackTrace();
}
JScrollPane scrollPane = new JScrollPane(
textPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
getContentPane().add("Center", scrollPane);
pack();
}
代码示例来源:origin: wiztools/rest-client
jp_help.setLayout(new BorderLayout());
JTextPane jtp_help_center = new JTextPane();
jtp_help_center.setEditable(false);
Dimension d = jtp_help_center.getPreferredSize();
jtp_help_center.setPreferredSize(d);
jtp_help_center.setCaretPosition(0);
JScrollPane jsp_center = new JScrollPane(jtp_help_center);
jp_help.add(jsp_center, BorderLayout.CENTER);
代码示例来源:origin: stackoverflow.com
JTextPane text = new JTextPane();
JButton button = new JButton("bold");
button.addActionListener(new StyledEditorKit.BoldAction());
JFrame frame = new JFrame("Styled");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(button, BorderLayout.NORTH);
frame.add(text, BorderLayout.CENTER);
frame.setSize(600, 400);
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
JTextPane jtp1 = new JTextPane();
jtp1.setText("bhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhbhbbbbbbbbbbbbbbbbhbbbbbbbbbbbbbbbbbb b");
jtp1.setEditable(false);
JPanel noWrapPanel = new JPanel( new BorderLayout() );
noWrapPanel.add( jtp1 );
JScrollPane scrollpane2 = new JScrollPane(noWrapPanel);
JFrame frame=new JFrame();
frame.add(scrollpane2);
frame.setSize(200,100);
frame.setVisible(true);
代码示例来源:origin: stackoverflow.com
private JFrame frame = new JFrame();
private JTextPane jtp;
private StyledDocument doc;
jtp = new JTextPane();
jtp.setText("\ntype some text in the above empty line and check the wrapping behavior");
doc = jtp.getStyledDocument();
JScrollPane scroll = new JScrollPane(jtp);
scroll.setPreferredSize(new Dimension(200, 200));
frame.add(scroll);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
代码示例来源:origin: RipMeApp/ripme
logText = new JTextPane();
logText.setEditable(false);
JScrollPane logTextScroll = new JScrollPane(logText);
logTextScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
logPanel.setVisible(false);
JScrollPane historyTableScrollPane = new JScrollPane(historyTable);
historyButtonRemove = new JButton(rb.getString("remove"));
historyButtonClear = new JButton(rb.getString("clear"));
queueList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
queueList.addMouseListener(new QueueMenuMouseListener());
JScrollPane queueListScroll = new JScrollPane(queueList,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
gbc.gridy = 0; pane.add(ripPanel, gbc);
gbc.gridy = 1; pane.add(statusPanel, gbc);
gbc.gridy = 2; pane.add(progressPanel, gbc);
gbc.gridy = 3; pane.add(optionsPanel, gbc);
gbc.weighty = 1;
内容来源于网络,如有侵权,请联系作者删除!