Created
August 31, 2023 14:58
-
-
Save apocalyptech/3585566f4079c53a18b01262689b892e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.EventQueue; | |
import java.awt.GridBagConstraints; | |
import java.awt.GridBagLayout; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.JScrollPane; | |
import javax.swing.JTextPane; | |
public class test | |
{ | |
public static void main(String[] args) | |
{ | |
EventQueue.invokeLater(() -> buildAndShowGui()); | |
} | |
private static void buildAndShowGui() | |
{ | |
// Set up the frame | |
JFrame frame = new JFrame(); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setSize(300, 200); | |
frame.setTitle("text"); | |
// Main panel | |
JPanel panel = new JPanel(); | |
panel.setLayout(new GridBagLayout()); | |
GridBagConstraints gc = new GridBagConstraints(); | |
gc.gridx = 0; | |
gc.gridy = 0; | |
gc.weightx = 500; | |
gc.weighty = 500; | |
gc.fill = GridBagConstraints.BOTH; | |
JScrollPane scrollPane = new JScrollPane(); | |
JTextPane textPane = new JTextPane(); | |
scrollPane.setViewportView(textPane); | |
panel.add(scrollPane, gc); | |
textPane.setText( | |
"asoidfaosdijoaisdjodjfodsjfoiadjsfoijdofjdosijfoasdjfoajdsfoijasdofjdoifjaosdfjaodsijfoij\n" | |
+ "sdandfiunadsiufnasidufidusn\n" | |
+ "asdfnasdoufn34ejnafdiunadsifunadsiufniuaenifneaiufneiunfiueanfiuaeniuenfe\n" | |
+ "asdfuioasdfoijasdoifj\n" | |
+ "adsofijasdofijadosifjoijefmaneoinfaeiounfiuenfiunefinaefoenawofineafoienafoenafiunaeiufneaiufnea\n" | |
); | |
// Add to frame and display | |
frame.add(panel); | |
frame.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment