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.
/*
* Created on 13.12.2004@17:30:21
*
* TODO Explain me ...
*/
package de.tutorials;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultTreeCellRenderer;
/**
* @author Darimont
*
*/
public class JTreeExample extends JFrame {
public JTreeExample() {
super("JTreeExample");
setDefaultCloseOperation(EXIT_ON_CLOSE);
JTree tree = new JTree();
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() {
{
setLeafIcon(new ImageIcon("c:/leafIcon.jpg"));
setOpenIcon(new ImageIcon("c:/openIcon.jpg"));
setClosedIcon(new ImageIcon("c:/closeIcon.jpg"));
}
};
BasicTreeUI ui = (BasicTreeUI) tree.getUI();
ui.setCollapsedIcon(new ImageIcon("c:/collapsedIcon.jpg"));
ui.setExpandedIcon(new ImageIcon("c:/expandedIcon.jpg"));
tree.setCellRenderer(renderer);
add(new JScrollPane(tree));
pack();
setVisible(true);
}
public static void main(String[] args) {
new JTreeExample();
}
}
/*
* Created on 13.12.2004@17:30:21
*
* TODO Explain me ...
*/
package de.tutorials;
import java.lang.reflect.Field;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultTreeCellRenderer;
/**
* @author Darimont
*
*/
public class JTreeExample extends JFrame {
public JTreeExample() {
super("JTreeExample");
setDefaultCloseOperation(EXIT_ON_CLOSE);
JTree tree = new JTree();
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() {
{
setLeafIcon(new ImageIcon("c:/leafIcon.jpg"));
setOpenIcon(new ImageIcon("c:/openIcon.jpg"));
setClosedIcon(new ImageIcon("c:/closeIcon.jpg"));
}
};
BasicTreeUI ui = (BasicTreeUI) tree.getUI();
try {
Field fld = BasicTreeUI.class.getDeclaredField("paintLines");
fld.setAccessible(true);
fld.set(ui, Boolean.FALSE);
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
//ui.setCollapsedIcon(new ImageIcon("c:/collapsedIcon.jpg"));
//ui.setExpandedIcon(new ImageIcon("c:/expandedIcon.jpg"));
ui.setExpandedIcon(null);
ui.setCollapsedIcon(null);
tree.setCellRenderer(renderer);
add(new JScrollPane(tree));
pack();
setVisible(true);
}
public static void main(String[] args) {
new JTreeExample();
}
}