MCPcopy Create free account
hub / github.com/chms/jdotxt / initGUI

Method initGUI

src/com/chschmid/jdotxt/gui/JdotxtGUI.java:126–258  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124 }
125
126 private void initGUI() {
127 // Style main window
128 this.setTitle(lang.getWord("jdotxt"));
129 this.setIconImage(icon.getImage());
130 this.setBackground(Color.WHITE);
131
132 // Create GUI elements
133 toolbar = new JdotxtToolbar();
134 filterPanel = new JdotxtFilterPanel();
135 taskList = new JdotxtTaskList();
136 tasksPane = new JScrollPane();
137 statusBar = new JdotxtStatusBar();
138
139 // Toolbar listeners
140 toolbar.getTextfieldSearch().setDocumentListener(new SearchListener());
141 toolbar.getButtonSave().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveTasks(false); } });
142 toolbar.getButtonReload().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { reloadTasks(); } });
143 toolbar.getButtonArchive().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { archiveTasks(); } });
144 toolbar.getButtonSettings().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { showSettingsDialog(); } });
145 //toolbar.setVisibleSaveReload(!Jdotxt.userPrefs.getBoolean("autosave", false));
146
147 // Other GUI element listeners
148 // What to do when the filters change
149 filterPanel.addFilterChangeListener(new MyFilterChangeListener());
150 // What to do when some task changes
151 taskList.addTaskListener(new StatusUpdateListener());
152 taskList.addTaskListener(new FilterUpdateListener());
153
154 // Autosave
155 autoSaver = new DelayedActionHandler(Jdotxt.AUTOSAVE_DELAY, new ActionListener() {
156 @Override
157 public void actionPerformed(ActionEvent e) {
158 if (!unresolvedFileModification) saveTasks(false);
159 }
160 });
161 autoSaveListener = new AutoSaveListener();
162 if (Jdotxt.userPrefs.getBoolean("autosave", false)) taskList.addTaskListener(autoSaveListener);
163
164 // Style taskPane
165 tasksPane.setBorder(BorderFactory.createEmptyBorder());
166 tasksPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
167 tasksPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
168 tasksPane.setViewportBorder(null);
169 tasksPane.getVerticalScrollBar().setBackground(Color.WHITE);
170 tasksPane.getVerticalScrollBar().setOpaque(true);
171 tasksPane.getVerticalScrollBar().putClientProperty("JScrollBar.fastWheelScrolling", false);
172 tasksPane.setViewportView(taskList);
173 tasksPane.getViewport().setBackground(Color.WHITE);
174 MyMouseWheelListener myMouseWheelListener = new MyMouseWheelListener(tasksPane.getMouseWheelListeners(), SCROLL_AMOUNT);
175 for (MouseWheelListener listener: tasksPane.getMouseWheelListeners()) tasksPane.removeMouseWheelListener(listener);
176 tasksPane.addMouseWheelListener(myMouseWheelListener);
177
178
179 // Add GUI elements to main window
180 this.add(toolbar, BorderLayout.PAGE_START);
181 this.add(filterPanel, BorderLayout.LINE_START);
182 this.add(tasksPane, BorderLayout.CENTER);
183 this.add(statusBar, BorderLayout.PAGE_END);

Callers 1

JdotxtGUIMethod · 0.95

Calls 13

resetMethod · 0.95
getWordMethod · 0.80
setBackgroundMethod · 0.80
setDocumentListenerMethod · 0.80
getTextfieldSearchMethod · 0.80
addActionListenerMethod · 0.80
getButtonSaveMethod · 0.80
getButtonReloadMethod · 0.80
getButtonArchiveMethod · 0.80
getButtonSettingsMethod · 0.80

Tested by

no test coverage detected