病狂
誰患了病 誰得了狂
在迷宮中找尋不到方向
遠方是左方 遠方是右方
我在無盡的思念裡找不到他鄉
握著手的 放開手的
原已放手的手持續糾纏
緊握住手的手 怎奈逃離 越遠越遠
我已走不了 我已患了病
看著你越來越遠的身影 我無力無力無力無力著
哪方?
你在河上 她在路上
你在路上 她在遠方
看不透的身影 是近 是遠
在你轉念想走時 卻走不得 無法不想
你在哪方? 你在哪方? 你在哪方?
我在心底 用心刻劃 你的位置
等你
20190323
昏昏暗暗的白光
搖晃不安地靈魂
誰在找我誰在看我
我在哪又身在何方
遠方前景 早已不見
是我不敢多想
亦又只是個麻醉劑
我 只是一個永遠無法找不到出口的人
1215沒看牙齒的日子
原本 今天要去看牙齒的
但沒去看牙齒
一來自己害怕看牙醫
二來自己害怕沒有錢
所以沒去看牙齒
坦白說,我真的很膽小
膽小到甚麼事好像都做不好
但是... 就算如此膽小的我
卻仍是對未來有憧憬
所以那怕看牙齒
那怕未來有許多的恐懼和害怕
一樣還是會選擇面對吧
■
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class JFrame7_3 {
JFrame f;
public static void main(String argv[]) {
new JFrame7_3();
}
public JFrame7_3() {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
f=new JFrame("JFrame 7-3");
f.setBounds(0,0,400,300);
f.setVisible(true);
f.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
int result=JOptionPane.showConfirmDialog(f, //或用 (Component)e.getSource() 亦可
"確定要結束程式嗎?",
"確認訊息",
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if (result==JOptionPane.YES_OPTION) {System.exit(0);}
//在構面裡建立對話框
}
});
}
}
java建立基本的構面:20181207
//建立構面之前要先加入awt和swing的相關資料庫
//建立框架步驟:建立框架→建立框架的函式→建立函式內容
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JFrame1 {
JFrame f; //建立框架
public static void main(String argv[]) {
new JFrame1(); //建立框架的函式
}
public JFrame1() { //建立函示內容
f=new JFrame("JFrame 1"); //建立框架的名稱
f.setBounds(0,0,400,300); //建立框架的大小
f.setVisible(true); //將框架可視覺化
}
}
PracticeJava20181201Listener
package MyFrame;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class MyFrame extends JFrame{
// 此視窗所用到的元件
int fieldWidth = 10;
JPanel panel, inPanel, outPanel;
JLabel inputFieldLabel, outputFieldLabel;
JTextField inputField, outputField;
JButton inputButton;
public MyFrame() {
super("視窗事件範例");//為什麼子類別可以繼承這個範例?這範例從哪來的?
initApp();
}
// 元件相關設置
public void initApp() {
panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
//BoxLayout是讓物件保持水平或垂直平行對齊的語法
inPanel = new JPanel();
outPanel = new JPanel();
inputFieldLabel = new JLabel("輸入文字");
inputField = new JTextField(fieldWidth);
inputField.addActionListener(new inputFieldActionListener()); // 要將事件處理加入
inputButton = new JButton("確定");
inputButton.addActionListener(new inputButtonActionListener()); // 要將事件處理加入
outputFieldLabel = new JLabel("輸出文字");
outputField = new JTextField(fieldWidth);
panel.add(inputFieldLabel);
panel.add(inputField);
panel.add(outputFieldLabel);
panel.add(outputField);
inPanel.add(inputFieldLabel);
inPanel.add(inputField);
inPanel.add(inputButton);
outPanel.add(outputFieldLabel);
outPanel.add(outputField);
panel.add(inPanel);
panel.add(outPanel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 300);
this.getContentPane().add(panel);
this.setVisible(true);
}
// inputField的事件處理
private class inputFieldActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
changeOutputText();
}
}
// inputButton的事件處理
private class inputButtonActionListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
changeOutputText();
}
}
public void changeOutputText() {
String input_field_str = inputField.getText();
outputField.setText(input_field_str);
}
public static void main(String[] args) {
MyFrame app = new MyFrame();
}
}