質問編集履歴

1

手直し

2016/09/30 07:22

投稿

daichanman123
daichanman123

スコア32

test CHANGED
File without changes
test CHANGED
@@ -156,6 +156,98 @@
156
156
 
157
157
  ```
158
158
 
159
+ ```ここに言語を入力
160
+
161
+ コード
162
+
163
+ public class MyLibrary{
164
+
165
+
166
+
167
+
168
+
169
+ /**
170
+
171
+ * パネル作成
172
+
173
+ */
174
+
175
+ public static JPanel createPanel(int PanelW, int PanelH, Color c, boolean opaque){
176
+
177
+ JPanel jp = new JPanel();
178
+
179
+
180
+
181
+ jp.setBackground(c); //背景色設定
182
+
183
+ jp.setLayout(null); //レイアウト手動設定
184
+
185
+ jp.setOpaque(opaque); //不透明化設定
186
+
187
+ jp.setBounds(0, 0, PanelW, PanelH); //位置・サイズ設定
188
+
189
+
190
+
191
+ return jp;
192
+
193
+ }
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ /**
202
+
203
+ * ラベル作成
204
+
205
+ */
206
+
207
+ public static JLabel createLabel(String str, int x, int y, int w, int h,
208
+
209
+ Color strColor, Color backColor, boolean opaque, int fontSize,
210
+
211
+ int FrameW, int FrameH, Color FrameColor, int FrameSize){
212
+
213
+ JLabel jl = new JLabel();
214
+
215
+
216
+
217
+ jl.setText(str); //文字設定
218
+
219
+ jl.setBounds(x, y, w, h); //位置・範囲設定
220
+
221
+ jl.setForeground(strColor); //文字色設定
222
+
223
+ jl.setBackground(backColor); //範囲背景設定
224
+
225
+ jl.setOpaque(opaque); //不透明化設定
226
+
227
+ jl.setFont(new Font(Font.MONOSPACED, Font.BOLD, fontSize)); //フォント設定
228
+
229
+ jl.setPreferredSize(new Dimension(FrameW,FrameH)); //枠領域設定
230
+
231
+ jl.setBorder(new LineBorder(FrameColor, FrameSize, true)); //枠色・大きさ・角設定
232
+
233
+ jl.setHorizontalAlignment(JLabel.CENTER); //枠内水平位置設定
234
+
235
+ jl.setVerticalAlignment(JLabel.CENTER); //枠内垂直位置設定
236
+
237
+
238
+
239
+ return jl;
240
+
241
+ }
242
+
243
+
244
+
245
+
246
+
247
+ }
248
+
249
+ ```
250
+
159
251
 
160
252
 
161
253
  上のプログラムですが