We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See image - the tree is cropped and too little indentation
Obtained by this code
package Tools.DarkculaTest;
import com.bulenkov.darcula.DarculaLaf;
import javax.swing.; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import java.awt.; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
public class DarkculaTest extends JFrame implements ActionListener { public DarkculaTest() throws HeadlessException { JTree jTree = new JTree(); Container contentPane = this.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(jTree, BorderLayout.CENTER); this.setSize(200, 300); CustomTreeNode root = new CustomTreeNode(0); jTree.setModel(new DefaultTreeModel(root));
JButton lookAndFeelSwitchButton = new JButton("Switch lookAndFeel"); lookAndFeelSwitchButton.addActionListener(this); contentPane.add(lookAndFeelSwitchButton, BorderLayout.SOUTH); } public void actionPerformed(ActionEvent actionEvent) { switchLookAndFeel(); SwingUtilities.updateComponentTreeUI(this); } private class CustomTreeNode extends DefaultMutableTreeNode { boolean areChildrenDefined = false; int level; private final int [] counts = new int []{5,7,4,7}; public CustomTreeNode(int level) { this.level = level; } public int getChildCount() { if(level == 4) return 0; if (!areChildrenDefined) defineChildNodes(); return (super.getChildCount()); } private void defineChildNodes() { areChildrenDefined = true; for(int index = 0; index < counts[level]; index++) add(new CustomTreeNode(level+1)); } } static boolean darculaOn = false; public static void main(String[] args) { switchLookAndFeel(); new DarkculaTest().setVisible(true); } private static void switchLookAndFeel() { try { if(darculaOn) UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); else UIManager.setLookAndFeel(new DarculaLaf()); darculaOn = !darculaOn; } catch (Exception e) { System.out.println("Unable to set look and feel"); } }
}
The text was updated successfully, but these errors were encountered:
The problem seems to be related to the code below in DarculaTreeUI - returning false instead in isSkinny fixes the problem.
@OverRide public int getRightChildIndent() { return isSkinny() ? 8 : super.getRightChildIndent(); }
private static boolean isSkinny() { return true; }
Sorry, something went wrong.
No branches or pull requests
See image - the tree is cropped and too little indentation
Obtained by this code
package Tools.DarkculaTest;
import com.bulenkov.darcula.DarculaLaf;
import javax.swing.;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import java.awt.;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DarkculaTest extends JFrame
implements ActionListener
{
public DarkculaTest() throws HeadlessException
{
JTree jTree = new JTree();
Container contentPane = this.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(jTree, BorderLayout.CENTER);
this.setSize(200, 300);
CustomTreeNode root = new CustomTreeNode(0);
jTree.setModel(new DefaultTreeModel(root));
}
The text was updated successfully, but these errors were encountered: