Skip to content

Commit f305a76

Browse files
authored
Merge pull request #25 from SidaDan/master
Implemented Frame Icon
2 parents 957d752 + d52a740 commit f305a76

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

icons/ste.png

771 Bytes
Loading

src/simplejavatexteditor/UI.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ public class UI extends JFrame implements ActionListener {
9393
private boolean edit = false;
9494

9595
public UI() {
96+
try {
97+
ImageIcon image = new ImageIcon("icons/ste.png");
98+
super.setIconImage(image.getImage());
99+
}
100+
catch (Exception ex) {
101+
ex.printStackTrace();
102+
}
103+
96104
// Set the initial size of the window
97105
setSize(800, 500);
98106

@@ -124,9 +132,14 @@ public void keyPressed(KeyEvent ke) {
124132
}
125133
});
126134

127-
// This is why we didn't have to worry about the size of the TextArea!
135+
136+
JScrollPane scrollPane = new JScrollPane(textArea);
137+
textArea.setWrapStyleWord(true);
138+
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
128139
getContentPane().setLayout(new BorderLayout()); // the BorderLayout bit makes it fill it automatically
129-
getContentPane().add(textArea);
140+
JPanel panel = new JPanel(new BorderLayout());
141+
panel.add(scrollPane);
142+
getContentPane().add(panel);
130143

131144
// Set the Menus
132145
menuFile = new JMenu("File");

0 commit comments

Comments
 (0)