Posts

Showing posts from May, 2020

Java Look and Feel: Customizability 2: Electric Boogaloo

This post is part of my Java Look and Feel Journey. See this post  for more details and table of contents (and to find a proper tutorial when it's available). That post will also guide you to another tutorial on using Java's Components & Layouts, so you can make a program to actually see the Look & Feel changes. At this point in the journey, you'd only need the first post , to have a button on screen to see the changes to it, but going further in that series is fine too. This is part 5 of the "Journey" posts. Follow this link for part 1: Getting Started  or this link for the previous part: 4. Customizability Now it's time to look at the current themes that exist in the Java API. If you look at MetalTheme (the abstract class), OceanTheme, and DefaultMetalTheme, you'll see that most of what they store is a bunch of ColorUIResource and FontUIResource values, which determine the colors and fonts to use in various components. I actually looked into this...

Java Look and Feel: Customizability

This post is part of my Java Look and Feel Journey. See this post for more details and table of contents (and to find a proper tutorial when it's available). That post will also guide you to another tutorial on using Java's Components & Layouts, so you can make a program to actually see the Look & Feel changes. At this point in the journey, you'd only need the first post , to have a button on screen to see the changes to it, but going further in that series is fine too. This is part 4 of the "Journey" posts. Follow this link for part 1: Getting Started or this link for the previous part: 3. Building the Border Wall When working on making a look and feel, one of the first things I looked at was the MetalTheme. I'm not sure why I skipped over it in these journey posts, but in actually using it, I decided from the start I'd be making my own theme. So with this post, we'll start making our own TadukooTheme and using it in TadukooLookAndFeel. We...

Java Look and Feel: Building the Border Wall

This post is part of my Java Look and Feel Journey. See this post  for more details and table of contents (and to find a proper tutorial when it's available). That post will also guide you to another tutorial on using Java's Components & Layouts, so you can make a program to actually see the Look & Feel changes. At this point in the journey, you'd only need the first post , to have a button on screen to see the changes to it, but going further in that series is fine too. This is part 3 of the "Journey" posts. Follow this link for part 1: Getting Started or this link for the previous part: 2. Button Journey Okay, so it's not exactly a wall, but we're talking about making the border for the button now, and hopefully by extension all of the components. I'm calling it TadukooBorder at the moment, but the name will likely change later. I started working on the border before finishing the button changes, so I had a rectangular button coloring with a...

Java Look and Feel: Button Journey

Image
This post is part of my Java Look and Feel Journey. See this post  for more details and table of contents (and to find a proper tutorial when it's available). That post will also guide you to another tutorial on using Java's Components & Layouts, so you can make a program to actually see the Look & Feel changes. At this point in the journey, you'd only need the first post , to have a button on screen to see the changes to it. This is part 2 of the "Journey" posts. Follow this link for part 1: Getting Started With the Look and Feel, the first thing I decided to do was to change the style of a button. I wanted to make it look like this (which comes from previous projects I've worked on where I made custom buttons before fully knowing about JButton): Basically it's a rectangle, but the top right and bottom left corners have triangles cut out (as you can obviously see). When I made this kind of button in my own projects in the past, I had a few preset ...

Java Components & Layouts: Labels, Text Fields, and Buttons! Oh My! (The Basics)

 This post is part of my Java Components & Layouts Tutorial. This tutorial is slightly linked to my Java Look & Feel Journey. See this post  for table of contents and more details about both this tutorial and my look and feel journey. In Java, there are various components you can use to create a GUI or form for the user to use. Today, we'll be going over the label, text field, and button (mainly because I think of these 3 components first). Now in my early programming, at first I didn't know about these, and then after that I didn't know they could be customized (and didn't like the regular look), so I didn't use them until less than two months ago. With work, I decided I wanted to do less work to make a GUI for a small utility program, so I started learning how to use these, and now I'm working on making my own Look and Feel to use these all the time moving forward. To start, we're going to make a class called MainFrame that extends JFrame. Note tha...

Java Look and Feel: Getting Started

 This post is part of my Java Look and Feel Journey. See this post  for more details and table of contents. When I first started with the Java Look and Feel (L&F), I found that if you're making a fully unique Look and Feel, you'll want to extend BasicLookAndFeel (from the javax.swing.plaf.basic package). If you use BasicLookAndFeel though, you need to create literally everything else needed for the look and feel in your own custom classes. This is probably the end goal (for me at least), but doing this would take a long time, and it'd be easier to just extend an existing look and feel and modify it slowly over time, making sure each piece is modified correctly before moving on. We'll be using the Metal Look and Feel for our new L&F, so we need to extend MetalLookAndFeel from the javax.swing.plaf.metal package. Because we're creating our own custom look and feel, we'll need to override getName(), getID(), and getDescription(). These can return whatever st...

Java Look and Feel Journey

 I've been working on slowly creating my own API from the ground up (as opposed to before , where I had a functioning program and tried to separate out an API), and I've realized I'm still doing it wrong. I've been creating my own classes for various menu functionality (e.g. Button, Text input, etc.) because I didn't know much about using the default Java Swing components and how to customize the looks of them. Long story short, for something at work I started to create a program with the default Java components (JTextField, JLabel, etc.) and I learned about Java's Look and Feel. Because of using this, I wanted to customize my own Look and Feel, but in my googling, I haven't found any good tutorials on how to do it. I'm ultimately finding bits and pieces of how to do it, and warnings that it's a massive undertaking. I have a history of wanting to program various projects that turn out to be massive undertakings, so this is nothing new to me, but I do...