Breaking the Kubernetes Kill Chain: Host Path Mount
T0
1. T0
Toward a class to handle putting a scrolling body of text
In a Java Swing Application
Part of the Series:
Look Ma: No LayoutManager
TP.pptx
TP.java
TP
4. TP.pptx
TP.java
TP
1. Declaration of pointer to the Control
ControlType V
JTextArea RT; TextArea TA;
V = new ControlType()
TA = new TextArea
(B.toString(),
NORows,maxLL);
RT = new JTextArea (NORows,maxLL);
5. static String [] JT = new
String [] {
"ONE True --- ONE ONE
----- ONE True ----- ONE
True ---- ONE True",
"TWO True --- TWO TWO
----- TWO True ----- TWO
True ---- TWO True",
"THREE True --- THREE
6. THREE ----- THREE True ----
- THREE True ---- THREE
True",
"FOUR True --- FOUR
FOUR ----- FOUR True -----
FOUR True ---- FOUR True"
};
7.
8. StringBuffer B;
B = new StringBuffer();
for (i=0;i<JT.length;i++){
B.append(JT[i]);
B.append ('n');
}
RT.setText(B.toString());
TA = new TextArea
(B.toString(),NORows,maxLL);
9. StringBuffer B;
B = new StringBuffer();
for (i=0;i<JT.length;i++){
B.append(JT[i]);
B.append ('n');
}
10. StringBuffer B;
B = new StringBuffer();
for (i=0;i<JT.length;i++){
B.append(JT[i]);
B.append ('n');
}
11. StrStringBuffer B;
B = new StringBuffer();
for (i=0;i<JT.length;i++){
B.append(JT[i]);
if (i!=JT.length-1){B.append ('n');}
}
12. String B;
B = new String();
for (i=0;i<JT.length;i++){
B = B + (JT[i]) + ‘n’;
}
O ( JT.length) 2
13. RT = new JTextArea (NORows,maxLL);
RT.setText(B.toString());
14. A B C
D E
G H I F
J L K M
P N Q O
P N
X
JT
maxLL
NOROWS 5
5
15. static Font SF;
static FontMetrics SFM;
static Graphics C;
SF = new Font ("Arial",Font.BOLD,12);
SFM = f.getFontMetrics(SF);
16. static Font SF;
static FontMetrics SFM;
static Graphics C;
SF = new Font ("Arial",Font.BOLD,12);
SFM = f.getFontMetrics(SF);
L = JT[i];
Rectangle2D WR = SFM.getStringBounds (L,C);
W= (int)WR.getWidth(););
if (W>maxLW) maxLW = W;
17. A B C
D E
G H I F
J L K M
P N Q O
P N
X
JT
int NORows = JT.length;
int height = SFM.getHeight();
int H = NORows*height;
That is six lines * the number of pixels in
18. V . setSize( width , height )
TA . Setsize ( 100 ,50 );
Step Three
19. V . setSize( width , height )
TA . Setsize ( 100 ,50 );
Step Three
20. V . setSize( width , height )
TA . Setsize ( 100 ,50 );
Step Three
21. Step Four
V . setLocation( x-pos , y-pos )
TA . setLocation( 50 ,200 );