Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7872617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:15:23+00:00 2026-06-03T02:15:23+00:00

I am creating a Swing GUI, I am using a series of JTextField .

  • 0

I am creating a Swing GUI, I am using a series of JTextField. I want to be able to add a custom property to the text field. This is going to be used to complete a calculation when focus is lost, for instance.

JTextField1.getCustomePram() * user input

I want a text field that will have a predefined value, it is for multiplying £20 * 5. So the default param will be 20 and the user will put the qty in, and on loss of focus the calculation will be done.

I am using Netbeans to build the GUI, I have tried extending the JTextField but to be honest I am not sure what to do, any advice or if I am going about this completely wrong please let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:15:25+00:00Added an answer on June 3, 2026 at 2:15 am

    I want a text field that will have a predefined value, it is for multiplying £20 * 5. So the default param will be 20 and the user will put the qty in, and on loss of focus the calculation will be done. .. if I am going about this completely wrong please let me know.

    You’re doing this completely wrong.

    For this I might use either a disabled text field or label for the unit price (£20), and a JSpinner for the quantity (5). Instead of doing the calculation on focus lost, add a change listener and show the user the new sub-total (and total if relevant) of the ordered item(s) in ‘real time’ – when the quantity is changed.

    Need to look at how I need to implement ideas in Java.

    A good place to look is the Visual Guide to Swing Components. Combine them in a layout for complex groups of components.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating custom Swing components and want to provide a UI that looks
I'm creating an application in Swing using NetBeans. I would like to be able
I am creating a Java Application using netBeans and Swing Gui Builder. I am
I'm creating an Swing GUI, I want to include a irc client into the
I am creating one GUI in swing Java. I have to use one button
So I am working on a GUI application using the swing framework. In short,
I started using jMonekyEngine and it's easy way of interacting with Swing GUI. Following
I have a question about GUI design, specifically with Java Swing and creating clean
I'm creating a simple board game in Java using Swing with an AI that
I am pretty capable when it comes creating GUIS in Java using Swing, however

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.