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 3690964
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:05:39+00:00 2026-05-19T04:05:39+00:00

public void movePiece(JLabel destination){ JLabel currentPiece = piece[oldIndex[0]][oldIndex[1]]; destination = currentPiece; currentPiece.setVisible(false); destination.repaint(); currentPiece.repaint();

  • 0
 public void movePiece(JLabel destination){
  JLabel currentPiece = piece[oldIndex[0]][oldIndex[1]];
  destination = currentPiece;
  currentPiece.setVisible(false);
  destination.repaint();
  currentPiece.repaint();
 }

Current method for moving. It takes the JLabel to which the text is to be “transferred”, the JLabel get’s a reference to the JLabel from which to take the text. Anyone got any idea? The method doesn’t work, just gives you an idea of how it’s going to look.

For example if this is the case:

JLabel 1: “Trololo”
JLabel 2: “Hello!”

if destination is 2 and currentPiece is 1, I’d like it to look like this:

JLabel 1: “Trololo” .setVisibility(false)
JLabel 2: “Trololo”

Effectively making only nr. 2 visible with the contents of nr. 1.
Don’t want to remove nr. 1, just keep it invisible.

(they are not referring to the same object, they just have the same text and font)

  • 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-05-19T04:05:40+00:00Added an answer on May 19, 2026 at 4:05 am

    Call setText to change the contents of the destination:

    public void movePiece(JLabel destination){
      JLabel currentPiece = piece[oldIndex[0]][oldIndex[1]];
      destination.setText(currentPiece.getText());
      currentPiece.setVisible(false);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void MyTest() { bool eventFinished = false; myEventRaiser.OnEvent += delegate { doStuff(); eventFinished
public void insertOrUpdate(String customerNumber, Long creditLimitAmount) throws SQLException { Connection connection2 = UBOCMSSQLConnectionUtill.getMSSqlConnection(); connection2.setAutoCommit(false);
public void wahey(List<Object> list) {} wahey(new LinkedList<Number>()); The call to the method will not
public void duplicate() { int repeatation = 0; Node current = root; Node duplicate
public void printSummaryForPatient(String name){ Patient p = findPatient(name); p.printPatientSummary(); p.computeBMI(); } My method to
public void printList( ){ Node<E> p ; System.out.printf( [ ) ; for ( p=head.next
public void openOptions() { Intent intent=new Intent(this,Game.class); //intent.putExtra(razmer, level); startActivity(intent); // Intent intent=new Intent(this,Options.class);
public void swap(Point var1, Point var2) { var1.x = 100; var1.y = 100; Point
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Init(); backthread tr=new backthread(); tr.execute(0,0,0); } backthread
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); TextView lattv=(TextView)findViewById(R.id.lat); TextView lngtv=(TextView)findViewById(R.id.lng); JSONParstring jParser =

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.