Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
public class MyTabbedPaneUI extends BasicTabbedPaneUI
{
private Insets myTabInsets = new Insets(10, 10, 10, 10);
public MyTabbedPaneUI()
{
}
protected Insets getTabInsets(int tabPlacement, int tabIndex)
{
return myTabInsets;
}
} // end of class MyTabbedPaneUI
...
JTabPanel m_tabPane = new JTabPane();
...
m_tabPane.setUI(new MyTabbedPaneUI());
package de.tutorials;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import java.util.Iterator;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
public class GlobalFontChangeExample extends JFrame {
public GlobalFontChangeExample() {
super("GlobalFontChangeExample");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
JLabel lbl = new JLabel("" + System.currentTimeMillis());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
lbl = new JLabel("" + System.currentTimeMillis() * Math.random());
add(lbl);
JButton btnChangeFontSize = new JButton("Change Fontsize +1");
btnChangeFontSize.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
UIDefaults uiDefaults = UIManager.getDefaults();
Enumeration keys = uiDefaults.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (key.toString().endsWith(".font")) {
Font font = uiDefaults.getFont(key);
font = new FontUIResource(font.deriveFont(font
.getSize() + 1.F));
uiDefaults.put(key, font);
}
}
SwingUtilities
.updateComponentTreeUI(GlobalFontChangeExample.this
.getContentPane());
pack();
}
});
add(btnChangeFontSize);
pack();
setVisible(true);
}
/**
* @param args
*/
public static void main(String[] args) {
new GlobalFontChangeExample();
}
}