Skip to content

Instantly share code, notes, and snippets.

@resarahadian
Last active August 29, 2015 14:10
Show Gist options
  • Save resarahadian/10d0e2615935321f0904 to your computer and use it in GitHub Desktop.
Save resarahadian/10d0e2615935321f0904 to your computer and use it in GitHub Desktop.
TabbedPane pada JOptionPane
import java.awt.*;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.plaf.ColorUIResource;
//import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
class OptionPaneTab {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@SuppressWarnings("static-access")
public void run() {
/*
* BeautyEyeLNFHelper.frameBorderStyle =
* BeautyEyeLNFHelper.FrameBorderStyle.osLookAndFeelDecorated;
* try { org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper
* .launchBeautyEyeLNF(); } catch (Exception e) { // TODO
* Auto-generated catch block e.printStackTrace(); }
*/
UIManager UI = new UIManager();
UI.put("OptionPane.background",
new ColorUIResource(255, 255, 0));
UI.put("Panel.background", new ColorUIResource(255, 255, 0));
JPanel gui = new JPanel(new BorderLayout(3, 3));
gui.setBorder(new TitledBorder("Tentang"));
JPanel controls = new JPanel(new FlowLayout(FlowLayout.CENTER,
5, 5));
controls.add(new JButton("Report Problem"));
controls.add(new JButton("Cancel"));
gui.add(controls, BorderLayout.SOUTH);
JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab("About", new JLabel("Web Browser for Linux"));
tabbedPane.addTab("License", new JLabel(
"Free and OpenSource Software"));
gui.add(tabbedPane, BorderLayout.CENTER);
ImageIcon img = new ImageIcon("src/TabOptionPane/midori.png");
JOptionPane.showMessageDialog(null, gui, "About",
JOptionPane.INFORMATION_MESSAGE, img);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment