জাভা swing ব্যবহার করে Button তৈরি করা যায় , যেখানে Button এ image Icon থাকবে
Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) – an API for providing a graphical user interface (GUI) for Java programs.
বিস্তারিত জানতে
wikipedia
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
public class ButtonDemo{ | |
ButtonDemo(){ | |
JFrame f=new JFrame("Button Example"); | |
JButton b=new JButton(new ImageIcon("Register.png")); // button with icon | |
b.setBounds(100,100,100,50); // button bounds | |
f.add(b); //adding button in frame | |
f.setSize(300,400); //frame size | |
f.setLayout(null); | |
f.setVisible(true); | |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
} | |
public static void main(String[] args) { | |
new ButtonDemo(); | |
} | |
} |
এবার দেখবো কিভাবে button এ Tool Tips ব্যবহার করা যায়।
Tool Tips ব্যবহার করার জন্য নিচের সিনট্যাক্স টি লিখতে হবে
button_object.setToolTipText("String_here");
নিচের কোডটি লক্ষ্য করি
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*;
public class ButtonDemowithTooltip{
ButtonDemowithTooltip(){
JFrame f=new JFrame("Button Example");
JButton b=new JButton(new ImageIcon("Register.png")); // button with icon
b.setBounds(100,100,100,50); // button bounds
b.setToolTipText("Click me after finiising All");
f.add(b); //adding button in frame
f.setSize(300,400); //frame size
f.setLayout(null);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new ButtonDemowithTooltip();
}
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
public class ButtonDemowithTooltip{ | |
ButtonDemowithTooltip(){ | |
JFrame f=new JFrame("Button Example"); | |
JButton b=new JButton(new ImageIcon("Register.png")); // button with icon | |
b.setBounds(100,100,100,50); // button bounds | |
b.setToolTipText("Click me after finiising All"); | |
f.add(b); //adding button in frame | |
f.setSize(300,400); //frame size | |
f.setLayout(null); | |
f.setVisible(true); | |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
} | |
public static void main(String[] args) { | |
new ButtonDemowithTooltip(); | |
} | |
} |