mirror of https://github.com/xfarrow/guify.git
Desktop is now more responsive
This commit is contained in:
parent
293b9c4a6e
commit
9cef4f2b8a
|
@ -86,39 +86,37 @@ public class Desktop extends JFrame implements IDesktopFrame {
|
||||||
public Desktop(Object controller) {
|
public Desktop(Object controller) {
|
||||||
this.controller = (DesktopController) controller;
|
this.controller = (DesktopController) controller;
|
||||||
|
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
setBounds(100, 100, 1280, 720);
|
setTitle(this.controller.getTitle());
|
||||||
getContentPane().setLayout(null);
|
getContentPane().setLayout(new BorderLayout());
|
||||||
setTitle(this.controller.getTitle());
|
|
||||||
|
treePanel = new JScrollPane();
|
||||||
treePanel = new JScrollPane();
|
// You can adjust the preferred size as needed
|
||||||
treePanel.setBounds(0, 36, 150, 634);
|
treePanel.setPreferredSize(new Dimension(150, 634));
|
||||||
getContentPane().add(treePanel);
|
getContentPane().add(treePanel, BorderLayout.WEST);
|
||||||
|
|
||||||
JScrollPane scrollPane = new JScrollPane();
|
desktopPanel = new JPanel();
|
||||||
scrollPane.setBounds(156, 36, 1098, 634);
|
desktopPanel.setLayout(new WrapLayout(FlowLayout.LEFT, 5, 5));
|
||||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
desktopPanel.setBackground(Color.WHITE);
|
||||||
scrollPane.getVerticalScrollBar().setUnitIncrement(25);
|
desktopPanel.addMouseListener(new MouseAdapter() {
|
||||||
getContentPane().add(scrollPane);
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
desktopPanel = new JPanel();
|
unselectAllNodes();
|
||||||
scrollPane.setViewportView(desktopPanel);
|
desktopPanel.requestFocus();
|
||||||
desktopPanel.setLayout(new WrapLayout(FlowLayout.LEFT, 5, 5));
|
}
|
||||||
desktopPanel.setBackground(Color.WHITE);
|
});
|
||||||
desktopPanel.addMouseListener(new MouseAdapter() {
|
|
||||||
@Override
|
JScrollPane scrollPane = new JScrollPane(desktopPanel);
|
||||||
public void mouseClicked(MouseEvent e){
|
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
unselectAllNodes();
|
scrollPane.getVerticalScrollBar().setUnitIncrement(25);
|
||||||
desktopPanel.requestFocus();
|
getContentPane().add(scrollPane, BorderLayout.CENTER);
|
||||||
}
|
|
||||||
});
|
toolBar = new JToolBar();
|
||||||
|
toolBar.setFloatable(false);
|
||||||
toolBar = new JToolBar();
|
toolBar.setBackground(GuifyColors.GRAY);
|
||||||
toolBar.setFloatable(false);
|
createJToolBar();
|
||||||
toolBar.setBounds(0, 0, 614, 37);
|
getContentPane().add(toolBar, BorderLayout.NORTH);
|
||||||
toolBar.setBackground(GuifyColors.GRAY);
|
setSize(1280, 720);
|
||||||
createJToolBar();
|
|
||||||
getContentPane().add(toolBar);
|
|
||||||
|
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,7 +135,6 @@ public class Desktop extends JFrame implements IDesktopFrame {
|
||||||
@Override
|
@Override
|
||||||
public void dragOver(DropTargetDragEvent dtde) {
|
public void dragOver(DropTargetDragEvent dtde) {
|
||||||
desktopPanel.setBorder(new LineBorder(GuifyColors.BLUE, 2));
|
desktopPanel.setBorder(new LineBorder(GuifyColors.BLUE, 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -440,6 +437,7 @@ public class Desktop extends JFrame implements IDesktopFrame {
|
||||||
*/
|
*/
|
||||||
private void createJToolBar() {
|
private void createJToolBar() {
|
||||||
JButton backBtn = new JButton();
|
JButton backBtn = new JButton();
|
||||||
|
|
||||||
backBtn.setBorderPainted(false);
|
backBtn.setBorderPainted(false);
|
||||||
backBtn.setBorder(new EmptyBorder(0, 0, 0, 0)); // Set empty border;
|
backBtn.setBorder(new EmptyBorder(0, 0, 0, 0)); // Set empty border;
|
||||||
backBtn.setToolTipText("Back");
|
backBtn.setToolTipText("Back");
|
||||||
|
@ -913,7 +911,9 @@ public class Desktop extends JFrame implements IDesktopFrame {
|
||||||
|
|
||||||
|
|
||||||
pathTextBox = new JTextField();
|
pathTextBox = new JTextField();
|
||||||
pathTextBox.setPreferredSize(new Dimension(100, pathTextBox.getPreferredSize().height));
|
pathTextBox.setMaximumSize(new Dimension(200, 35));
|
||||||
|
pathTextBox.setMinimumSize(new Dimension(50, 35));
|
||||||
|
pathTextBox.setPreferredSize(new Dimension(200, 35));
|
||||||
Font font = pathTextBox.getFont();
|
Font font = pathTextBox.getFont();
|
||||||
Font biggerFont = font.deriveFont(font.getSize() + 4f); // Increase font size by 4
|
Font biggerFont = font.deriveFont(font.getSize() + 4f); // Increase font size by 4
|
||||||
pathTextBox.setFont(biggerFont);
|
pathTextBox.setFont(biggerFont);
|
||||||
|
|
Loading…
Reference in New Issue