第1回では、JFrameを使ってウィンドウを表示するまでの手順を紹介しました。今回は、ボタンやラベルといったGUIコンポーネントを紹介するとともに、それらをJFrameに配置する方法を紹介しましょう。 Swingコンポーネントの種類 実際にコンポーネントを配置 ...
JSR 274で仕様の標準化が進められているBeanShellは、JavaVM上で動作するスクリプト言語である。文法がJavaのそれとほとんど同じという点が大きな特徴といえる。もちろん、動的な型付けに対応しているなど、スクリプト言語としての利点も兼ね揃えている。
Developers Summit 2026・Dev x PM Day 講演資料まとめ Developers Boost 2025 講演資料まとめ 翔泳社では、「独習」「徹底入門」「スラスラわかる」「絵で見てわかる」「一年生」などの人気シリーズをはじめ、言語や開発手法、最新技術を解説した書籍を多数手がけています ...
配置した各コンポーネントについて解説をしていきましょう。 ContentPane ContentPaneとは、JFrameの表示領域です。 JFrameに表示したいコンポーネントは、ContentPaneに追加する必要があります。 ・ContentPaneの取得 Container contentPane = mainFrame.getContentPane(); 上記コードの ...
Here we can pass a first class function "change_text" directly to the JButton in it's constructore, in place of the more cumbersome Java "addActionListener" method where we need to create an anonymous ...
Here we can pass a first class function "change_text" directly to the JButton in it's constructore, in place of the more cumbersome Java "addActionListener" method where we need to create an anonymous ...
Ever since I was introduced to Infobus from the early days of Java, I have been a big fan of bus-based architecture. What is bus-based architecture? Let me explain this by way of an example. In a ...
96、Swing组件的探索与应用 本文深入探讨了Java Swing库中的多种常用组件,包括JTextField、JButton、JToggleButton、JCheckBox、JRadioButton和JTabbedPane等,并通过具体代码示例展示了它们的使用方法与事件处理机制。这些组件为构建功能丰富、交互性强的图形用户界面提供了 ...
下面的示例向您展示了如何自定义JButton摇摆组件的图标。package org.nhooo.example.swing; import javax.swing.*; import java.awt.*; //零件。有 ...