forked from anishmu20/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormat.java
More file actions
48 lines (37 loc) · 1.23 KB
/
Format.java
File metadata and controls
48 lines (37 loc) · 1.23 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
import java.awt.*;
public class Format {
GUI gui;
String SELECTEDString;
Font arial ,ComicSansMS,timeNewRoman;
Format(GUI gui){
this.gui=gui;
}
public void wrapword(){
if (gui.wordwrapOn==false){
gui.wordwrapOn=true;
gui.textArea.setLineWrap(true);
gui.textArea.setWrapStyleWord(true);
gui.iWrap.setText("Wrap Word:On");
}
else if (gui.wordwrapOn==true){
gui.wordwrapOn=false;
gui.textArea.setLineWrap(false);
gui.textArea.setWrapStyleWord(false);
gui.iWrap.setText("Wrap Word:Off");
}
}
public void createFont(int fontSize){
arial=new Font("Arial",Font.PLAIN,fontSize);
ComicSansMS=new Font("ComicSansMS",Font.PLAIN,fontSize);
timeNewRoman=new Font("TimeNewRoman",Font.PLAIN,fontSize);
selectfont(SELECTEDString);
}
public void selectfont(String font){
SELECTEDString=font;
switch(SELECTEDString){
case "Time Of New Roman":gui.textArea.setFont(timeNewRoman); break;
case "Comic Sans MS":gui.textArea.setFont(ComicSansMS); break;
case "Arial":gui.textArea.setFont(arial);
}
}
}