31
31
32
32
* Removed unuse objects like container, Border emptyBorder
33
33
* Removed unsused imports
34
- *
34
+ *
35
35
* @Modifiedby Giorgos Pasentsis
36
36
37
37
*/
@@ -61,11 +61,10 @@ public class UI extends JFrame implements ActionListener {
61
61
JButton newButton , openButton , saveButton , clearButton , quickButton , aboutMeButton , aboutButton , closeButton , boldButton , italicButton ;
62
62
private final Action selectAllAction ;
63
63
64
-
65
64
//setup icons - Bold and Italic
66
65
private final ImageIcon boldIcon = new ImageIcon ("icons/bold.png" );
67
66
private final ImageIcon italicIcon = new ImageIcon ("icons/italic.png" );
68
-
67
+
69
68
// setup icons - File Menu
70
69
private final ImageIcon newIcon = new ImageIcon ("icons/new.png" );
71
70
private final ImageIcon openIcon = new ImageIcon ("icons/open.png" );
@@ -94,7 +93,6 @@ public class UI extends JFrame implements ActionListener {
94
93
private boolean edit = false ;
95
94
96
95
public UI () {
97
-
98
96
// Set the initial size of the window
99
97
setSize (800 , 500 );
100
98
@@ -319,13 +317,13 @@ public void actionPerformed(ActionEvent ev) {
319
317
closeButton .addActionListener (this );
320
318
mainToolbar .add (closeButton );
321
319
mainToolbar .addSeparator ();
322
-
320
+
323
321
boldButton = new JButton (boldIcon );
324
322
boldButton .setToolTipText ("Bold" );
325
323
boldButton .addActionListener (this );
326
324
mainToolbar .add (boldButton );
327
325
mainToolbar .addSeparator ();
328
-
326
+
329
327
italicButton = new JButton (italicIcon );
330
328
italicButton .setToolTipText ("Italic" );
331
329
italicButton .addActionListener (this );
@@ -380,7 +378,6 @@ public void actionPerformed(ActionEvent ev) {
380
378
381
379
Font font1 = new Font (fontFamily , Font .PLAIN , sizeOfFont );
382
380
textArea .setFont (font1 );
383
-
384
381
}
385
382
});
386
383
//FONT SIZE SETTINGS SECTION END
@@ -508,18 +505,14 @@ else if (e.getSource() == saveFile || e.getSource() == saveButton) {
508
505
else if (e .getSource () == boldButton ) {
509
506
if (textArea .getFont ().getStyle () == Font .BOLD ){
510
507
textArea .setFont (textArea .getFont ().deriveFont (Font .PLAIN ));
511
-
512
- }
513
- else {
508
+ } else {
514
509
textArea .setFont (textArea .getFont ().deriveFont (Font .BOLD ));
515
510
}
516
511
}// If the source of the event was the "Italic" button
517
512
else if (e .getSource () == italicButton ) {
518
513
if (textArea .getFont ().getStyle () == Font .ITALIC ){
519
514
textArea .setFont (textArea .getFont ().deriveFont (Font .PLAIN ));
520
-
521
- }
522
- else {
515
+ } else {
523
516
textArea .setFont (textArea .getFont ().deriveFont (Font .ITALIC ));
524
517
}
525
518
}
@@ -543,7 +536,6 @@ else if (e.getSource() == aboutMe || e.getSource() == aboutMeButton) {
543
536
else if (e .getSource () == aboutSoftware || e .getSource () == aboutButton ) {
544
537
new About (this ).software ();
545
538
}
546
-
547
539
}
548
540
549
541
class SelectAllAction extends AbstractAction {
@@ -591,4 +583,5 @@ private void saveFile() {
591
583
}
592
584
}
593
585
}
586
+
594
587
}
0 commit comments