註冊
登錄
論壇
搜索
幫助
導航
私人消息 (0)
公共消息 (0)
系統消息 (0)
好友消息 (0)
帖子消息 (0)
種子論壇 | 高雄市資訊培育協會學員討論區
»
結訓課程 (青少年程式設計班)
»
Java(五1930)
» 佈局元件 - BorderLayout
返回列表
發帖
發短消息
加為好友
tonyh
當前離線
UID
94
帖子
7024
精華
21
積分
210
閱讀權限
150
在線時間
2581 小時
註冊時間
2011-1-8
最後登錄
2024-9-19
超級版主
1
#
跳轉到
»
倒序看帖
打印
字體大小:
t
T
tonyh
發表於 2017-9-15 20:39
|
只看該作者
佈局元件 - BorderLayout
本帖最後由 tonyh 於 2019-9-7 14:53 編輯
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch115 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch115()
{
JButton btn1=new JButton("xxx");
JButton btn2=new JButton("xxxxxxx");
JButton btn3=new JButton("xxxxxxxxxxx");
JButton btn4=new JButton("xxxxxxxxx xxxxxxx");
JButton btn5=new JButton("xxx");
//JButton btn6=new JButton("x");
fm=new JFrame("BorderLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(5,5));
//如果沒有設Layout,則預設值就是 BorderLayout
//BorderLayout 預設物件之間的水平及垂直距離為0像素
fm.add(btn1, BorderLayout.NORTH);
fm.add(btn2, BorderLayout.SOUTH);
fm.add(btn3, BorderLayout.WEST);
fm.add(btn4, BorderLayout.CENTER);
fm.add(btn5, BorderLayout.EAST);
//fm.add(btn6, BorderLayout.EAST);
}
public static void main(String[] args) {
new Ch115();
}
}
複製代碼
收藏
分享
發短消息
加為好友
陳思惟
當前離線
UID
67672
帖子
336
精華
0
積分
15
閱讀權限
10
在線時間
100 小時
註冊時間
2015-1-29
最後登錄
2021-7-28
新手上路
2
#
陳思惟
發表於 2017-9-15 21:00
|
只看該作者
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch115 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch115()
{
JButton btn1=new JButton("xxx");
JButton btn2=new JButton("xxxxxxx");
JButton btn3=new JButton("xxxxxxxxxxx");
JButton btn4=new JButton("xxxxxxxxx xxxxxxx");
JButton btn5=new JButton("xxx");
//JButton btn6=new JButton("x");
fm=new JFrame("BorderLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(5,5));
//如果沒有設Layout,則預設值就是 BorderLayout
//BorderLayout 預設物件之間的水平及垂直距離為0像素
fm.add(btn1, BorderLayout.NORTH);
fm.add(btn2, BorderLayout.SOUTH);
fm.add(btn3, BorderLayout.WEST);
fm.add(btn4, BorderLayout.CENTER);
fm.add(btn5, BorderLayout.EAST);
//fm.add(btn6, BorderLayout.EAST);
}
public static void main(String[] args) {
new Ch115();
}
}
複製代碼
TOP
發短消息
加為好友
黃璽安
(Andy)
當前離線
UID
67668
帖子
385
精華
0
積分
0
閱讀權限
100
在線時間
85 小時
註冊時間
2015-1-29
最後登錄
2024-1-31
版主
3
#
黃璽安
發表於 2017-9-15 21:05
|
只看該作者
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch114 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch114()
{
JButton btn1=new JButton("xxx");
btn1.setBounds(0, 0, 100, 100);
btn1.setSize(100, 100);
JButton btn2=new JButton("xxxxxxx");
JButton btn3=new JButton("xxxxxxxxxxx");
JButton btn4=new JButton("xxxxxxxxx xxxxxxx");
JButton btn5=new JButton("xxx");
JButton btn6=new JButton("x");
fm=new JFrame("GridLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(5,5));
new BorderLayout();
fm.add(btn1, BorderLayout.NORTH);
fm.add(btn2, BorderLayout.SOUTH);
fm.add(btn3, BorderLayout.WEST);
fm.add(btn4, BorderLayout.CENTER);
fm.add(btn5, BorderLayout.EAST);
fm.add(btn6, BorderLayout.EAST);
}
public static void main(String[] args) {
new Ch114();
}
}
複製代碼
TOP
發短消息
加為好友
洪振庭
當前離線
UID
67646
帖子
394
精華
0
積分
0
閱讀權限
10
在線時間
103 小時
註冊時間
2014-6-30
最後登錄
2020-1-4
新手上路
4
#
洪振庭
發表於 2017-9-15 21:05
|
只看該作者
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch113 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch113()
{
JButton btn1=new JButton("x 456 x");
JButton btn3=new JButton(" ______/* ____ ");
JButton btn4=new JButton("_____ _______________");
JButton btn5=new JButton(" 1 1 1 ");
JButton btn6=new JButton(" 1 1 4 1 4 ");
JButton btn2=new JButton(" 1 8 7 12 ");
fm=new JFrame("GridLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(4, 0));
fm.add(btn1,BorderLayout.CENTER);
fm.add(btn2,BorderLayout.SOUTH);
fm.add(btn3,BorderLayout.EAST);
fm.add(btn4,BorderLayout.NORTH);
fm.add(btn5,BorderLayout.WEST);
}
public static void main(String[] args) {
new Ch113();
}
}
複製代碼
TOP
發短消息
加為好友
曾挺桂
當前離線
UID
67676
帖子
342
精華
0
積分
0
閱讀權限
10
在線時間
53 小時
註冊時間
2015-3-14
最後登錄
2018-2-10
新手上路
5
#
曾挺桂
發表於 2017-9-22 20:31
|
只看該作者
本帖最後由 曾挺桂 於 2017-9-29 21:05 編輯
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch115 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch115()
{
JButton btn1=new JButton("xxx");
JButton btn2=new JButton("xxxxxxx");
JButton btn3=new JButton("xxxxxxxxxxx");
JButton btn4=new JButton("xxxxxxxxx xxxxxxx");
JButton btn5=new JButton("xxx");
//JButton btn6=new JButton("x");
fm=new JFrame("BorderLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(5,5));
fm.add(btn1, BorderLayout.NORTH);
fm.add(btn2, BorderLayout.SOUTH);
fm.add(btn3, BorderLayout.WEST);
fm.add(btn4, BorderLayout.CENTER);
fm.add(btn5, BorderLayout.EAST);
//fm.add(btn6, BorderLayout.EAST);
}
public static void main(String[] args) {
new Ch115();
}
}
複製代碼
TOP
發短消息
加為好友
李知易
當前離線
UID
67631
帖子
589
精華
0
積分
0
閱讀權限
10
在線時間
152 小時
註冊時間
2014-6-30
最後登錄
2022-6-7
新手上路
6
#
李知易
發表於 2017-9-29 20:11
|
只看該作者
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.BorderLayout;
public class Ch105 {
JFrame fm;
JButton btn1,btn2,btn3,btn4,btn5,btn6;
Ch105()
{
JButton btn1=new JButton("x 456 x");
JButton btn3=new JButton(" ______/* ____ ");
JButton btn4=new JButton("_____ _______________");
JButton btn5=new JButton(" 1 1 1 ");
JButton btn6=new JButton(" 1 1 4 1 4 ");
JButton btn2=new JButton(" 1 8 7 12 ");
fm=new JFrame("GridLayout");
fm.setBounds(100, 100, 300, 200);
fm.setVisible(true);
fm.setResizable(true);
fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm.setLayout(new BorderLayout(4, 0));
fm.add(btn1,BorderLayout.CENTER);
fm.add(btn2,BorderLayout.SOUTH);
fm.add(btn3,BorderLayout.EAST);
fm.add(btn4,BorderLayout.NORTH);
fm.add(btn5,BorderLayout.WEST);
}
public static void main(String[] args) {
new Ch105();
}
}
複製代碼
EEEEEEEEEEEEELLLLLLLLLLLLLIIIIIIIIIIIII
TOP
返回列表
十全國小資優班 - 基本文書研習
谷哥人營隊
113Scratch夏令營
113年APCS冬令營
113年Scratch冬令營
113年Python研習冬令營
113年Python證照特訓營(一)
113年谷哥人程式體驗營
113年國三專班
113年Python研習夏令營
113年Python證照特訓營(二)
113年程式夏令營(一)(二)
113年APCS夏令營(一)(二)
112年國三專班
112APCS夏令營(一)(二)
112App快速開發夏令營
C語言 / C++ (特別輔導)
C++證照
C#
家教特輔
C語言特輔/證照(家教)
C++證照
C#
HTML5+CSS+JavaScript+PHP+MySQL
Java 家教 (王捷恩)
113新版塊名稱
快樂學 Scratch
Python 家教 (王捷恩 康恒睿)
Python 特別輔導 (家教)
快樂 C++ (家教)
我愛 Java (家教)
程式解題我最行 (家教)
程式常態班
C++ 新生挑戰區
考照心得分享
快樂 C++11307週五19:00
快樂 C++11303 (週六15:40-17:40) 3F
程式解題我最行 (週六15:30-17:30) 3F
快樂 C++ (週六13:30-15:30) 3F
快樂 C++ (週六19:00-21:00) 3F
程式解題我最行 (週六10:00-12:00) 3F
快樂學 Scratch
程式解題我最行(週五19:00-21:00)
快樂 C++ (週六13:30-15:30) 3F
程式解題我最行(週三19:15-21:15)
快樂 C++11207週六10
快樂 C++11208週六19:00
程式解題我最行 (週五19:00-21:00) 3F
快樂 C++ (週六15:30-17:30) 3F
程式解題我最行 (週六19:00-21:00) 3F
程式解題我最行 (週四19:10-21:10)
產投職訓
結訓課程 (產投職訓)
Php & MySQL old
Illustrator old
Dreamweaver old
Android手機程式開發班
PHP & MySQL電子商務互動式網站實作班 (102下)
PHP & MySQL (102上)
PHP & MySQL電子商務互動式網站實作班
Photoshop數位影像設計初階
Flash創意廣告動畫初階
行銷短片視訊剪輯
數位商業攝影實務班
PHP & MySQL電子商務系統開發實務初階班
電子商務系統開發實務中階班
Server基礎架設&動態網頁設計初階班
Java視窗應用程式設計與遊戲開發班
Illustrator時尚插畫創作設計初階班
102上Php & MySQL 初階班
電子商務互動式網站實作中階
Dreamweaver多媒體網頁設計
Android手機程式開發班(2012年10月)
PHP & MySQL (2012年10月)
創意塗鴉
yahoo橫幅
google橫幅
市民學苑
第二屆樂活部落格
第一屆電腦設備簡易維護和故障排除班
專案訓練
電子商務創業班
TQC PHP認證
投資理財班
領隊導遊班
電腦基礎及網路應用身心障礙專班
應用軟體網頁化開發
[收藏此主題]
[關注此主題的新回復]
[通過 QQ、MSN 分享給朋友]