-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction_Format.java
More file actions
54 lines (43 loc) · 1.17 KB
/
Function_Format.java
File metadata and controls
54 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.awt.Font;
public class Function_Format {
GUI gui;
Font arial, comicSansMS, timesNewRoman;
String selectedFont;
public Function_Format(GUI gui) {
this.gui = gui;
}
public void wordWrap() {
if(gui.wordWrapOn==false) {
gui.wordWrapOn=true;
gui.textArea.setLineWrap(true);
gui.textArea.setWrapStyleWord(true);
gui.iWrap.setText("Word Wrap: On");
}
else if(gui.wordWrapOn==true) {
gui.wordWrapOn=false;
gui.textArea.setLineWrap(false);
gui.textArea.setWrapStyleWord(false);
gui.iWrap.setText("Word Wrap: Off");
}
}
public void createFont(int fontSize) {
arial = new Font("Arial", Font.PLAIN, fontSize);
comicSansMS = new Font("Comic Sans MS", Font.PLAIN, fontSize);
timesNewRoman = new Font("Times New Roman", Font.PLAIN, fontSize);
setFont(selectedFont);
}
public void setFont(String font) {
selectedFont = font;
switch(selectedFont) {
case "Arial":
gui.textArea.setFont(arial);
break;
case "Comic Sans MS":
gui.textArea.setFont(comicSansMS);
break;
case "Times New Roman":
gui.textArea.setFont(timesNewRoman);
break;
}
}
}