Question: When you run the code below. does the TwxtArea have. a horizontal scrollbar? Does it have a vertical scrollbar? If yes, when are they displayed?
When you run the code below. does the TwxtArea have. a horizontal scrollbar? Does it have a vertical scrollbar? If yes, when are they displayed? how many lines of the text are displayed in the Text Area at a time? e?

private static final long serial versionUID = IL; private static void createAndShowGUI() { // Create and set up the window. final JFrame frame = new JFrame("Scroll Pane Example"); // Display the window. frame.setSize(200, 200); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // set flow layout for the frame frame.getContentPane().setLayout(new FlowLayout()); JTextArea textArea = new JTextArea(5, 5); JScrollpane scrollableTextArea = new JScrollpane(textArea); scrollableTextArea.setHorizontalScrollBarPolicy(JScrollpane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollableTextArea.setVerticalScrollbarPolicy(Scrollpane. VERTICAL_SCROLLBAR_ALWAYS); frame.getContentPane().add(scrollableTextArea); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
