Code Cleanup

This commit is contained in:
Konloch 2021-06-28 18:25:24 -07:00
parent fc36f3562d
commit 812f4ea3cd

View file

@ -42,6 +42,7 @@ import static the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane.BLA
* Allows us to run a background thread * Allows us to run a background thread
* *
* @author Konloch * @author Konloch
* @author WaterWolf
* @author DreamSworK * @author DreamSworK
*/ */
public abstract class PaneUpdaterThread implements Runnable public abstract class PaneUpdaterThread implements Runnable
@ -83,23 +84,26 @@ public abstract class PaneUpdaterThread implements Runnable
attachCtrlMouseWheelZoom(updateUpdaterTextArea.getScrollPane(), updateUpdaterTextArea)); attachCtrlMouseWheelZoom(updateUpdaterTextArea.getScrollPane(), updateUpdaterTextArea));
} }
public void attachCtrlMouseWheelZoom(RTextScrollPane scrollPane, RSyntaxTextArea panelArea) { public void attachCtrlMouseWheelZoom(RTextScrollPane scrollPane, RSyntaxTextArea panelArea)
{
if (scrollPane == null) if (scrollPane == null)
return; return;
scrollPane.addMouseWheelListener(e -> { scrollPane.addMouseWheelListener(e ->
{
if (panelArea == null || panelArea.getText().isEmpty()) if (panelArea == null || panelArea.getText().isEmpty())
return; return;
if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) { if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0)
{
Font font = panelArea.getFont(); Font font = panelArea.getFont();
int size = font.getSize(); int size = font.getSize();
if (e.getWheelRotation() > 0) { //Up
if (e.getWheelRotation() > 0) //Up
panelArea.setFont(new Font(font.getName(), font.getStyle(), --size >= 2 ? --size : 2)); panelArea.setFont(new Font(font.getName(), font.getStyle(), --size >= 2 ? --size : 2));
} else { //Down else //Down
panelArea.setFont(new Font(font.getName(), font.getStyle(), ++size)); panelArea.setFont(new Font(font.getName(), font.getStyle(), ++size));
} }
}
e.consume(); e.consume();
}); });
} }