UI Packages


MWindow Java Swing Skin

Topic: UI Packages
Date: 01/03/2015

Description

MWindow was a quick project that I started in the first semester of University. It was a way of getting reacquainted with Java and learning about the inner workings of the Java Swing library. This project was a brief introduction to programming architecture design patterns as it was the first time that I had seen an observer pattern. Since then I have learnt a lot more about the design patterns but still look back with fondness at this project.

The MWindow package is a minimalist UI redesign for the swing package. MWindow allows for the easy creation of a blank windows, as well as a better looking frame for a draggable window. The project was madel for java swing so the implementation is compatible with swing in general and the classes have similar methods. This is due to the components being subclasses of the respective Java Swing class. For example, MButton is just an extension of JButton with an overrided paintComponent method.

Examples

Input

//Create the window and button
MDragWindow window = new MDragWindow("New Window");
MButton button = new MButton("Click me");

//Add the event listener to the button
button.addMActionListener((MActionEvent e) -> {System.out.print("Hello!");});

//Add the button and revalidate
window.add(button);
window.revalidate();
window.setVisible(true);

Screenshots:

A screenshot of a drawing application implemented with mwindow A screenshot of an image viewer application implemented with mwindow

Links:

Github | Zip File | Examples Zip File