₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,948 members, 8,447,887 topics. Date: Sunday, 19 July 2026 at 08:59 AM

Toggle theme

Csharpjava's Posts

Nairaland ForumCsharpjava's ProfileCsharpjava's Posts

1 2 3 4 5 6 7 8 9 10 (of 12 pages)

ProgrammingRe: Need A Developer For A Three Dimensional Store by csharpjava(m): 5:16pm On Jan 02, 2014
@OP

Here are some good links that will help you to quickly learn 3D modeling.

http://www.videotutorialsrock.com Video or text


https://www.youtube.com/watch?v=zylsMzCHmgA 3D Geometry
ProgrammingRe: I Need Help From ASP.NET Gurus Urgently by csharpjava(m):
You will need a button for new 'comments' and a 'quote' button which will only appear under an existing comment, using an if -- Else statement to check if there is a comment already in the database, this will require having a column in your database with an initial value of 0 for no comment and set to 1 when a comment has been added.

For text formatting you'll need a plug-In for the text editor unless you want to write your own text editor.

I hope this helps.
ProgrammingRe: Who Wants To Get Nerdy And Do Some Networking Subnet Problems? by csharpjava(m):
Fulaman198: Thanks, but just wanted to see if anyone wanted to have fun doing subnetting problems, not on how yo actually do it.
The videos in the links I posted will allow more people to join in which will create more fun.
ProgrammingRe: Who Wants To Get Nerdy And Do Some Networking Subnet Problems? by csharpjava(m): 9:34pm On Dec 25, 2013
ProgrammingRe: Developing Accounting Application Using MS Excel And Access by csharpjava(m):
You need to learn Visual Basic for Applications (VBA) or Visual Studio Tools for Office (VSTO)
ProgrammingRe: Developing Accounting Application Using MS Excel And Access by csharpjava(m): 7:43pm On Dec 08, 2013
You can start with excel and access.
ProgrammingRe: Developing Accounting Application Using MS Excel And Access by csharpjava(m):
You can but it won't look as good and powerful as peachtree or quickbook.
ProgrammingRe: Need Help On Programming Language(c#) by csharpjava(m): 12:55pm On Dec 07, 2013
grocery: programmers in the house please help me out,am developing an online examination system but the database i was thought is ms-access,buh i want to use SQL. how will i connect to sql databse
Do you want the SQL connection embedded in your code or do you want the SQL connection to be in the WebConfig file?
ProgrammingRe: Which Is The Better Programming Institution In India! by csharpjava(m):
ProgrammingRe: Three Nigerian Students Develop 'iTunes' - CNN by csharpjava(m): 1:29pm On Nov 29, 2013
fingard02k: another nairaland in making
"The startup's three founders, who've all studied computer science"
http://edition.cnn.com/2013/11/28/tech/nigerian-itunes-dances-mobile-beat/index.html?hpt=hp_bn5

Would they have been able to pull this through without a degree in Computer Science?
WebmastersRe: Bitcoin - P2P Digital Currency by csharpjava(op): 8:43pm On Nov 28, 2013
lordZOUGA: I hope it gets popular.
their wiki said the technology was created in 1998 though.
A Norwegian man who bought £15 worth of bitcoins and then forgot about them for four years has been able to buy a flat in Oslo thanks to the huge appreciation of the virtual currency.

Kristoffer Koch was doing research on encryption in 2009 when on a whim he decided to invest a small sum in the recently-created bitcoins.

Mr Koch, now 29 and working as an engineer, only remembered the investment in April this year when he read an article about the soaring value of bitcoins.

His 5,000 bitcoins were suddenly worth around £430,000.

After spending a full day trying to remember his password, Mr Koch cashed in £116,000 by selling a fifth of his newly-acquired fortune.

http://news.sky.com/story/1161340/bitcoin-man-buys-flat-with-forgotten-fortune
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
PhenomenonVFX: I dont know which is more hilarious; ur ignorance or ur dishonesty. Nobody is telling u they have all the knowledge but we are teaching u here. It will do u well to learn. And if u incapable of that, at least stop disgracing urself.

a coloured image like that will have at least 3 bytes to represent a pixel. Since each pixel carries 3 color channels: red, green and blue.
The colour of any pixel in a coloured image is a combination of different values of RGB.
White is 255,255,255 or 24 "1"s in binary or 0xffffff in hexadecimal.
Black is 0,0,0 or 24 "0"s in binary or Ox000000 in hexadecimal.

Now to ur post. In ur dishonesty, said that the image above consists of that long string of "01"s u posted. That will mean that each pixel is: "010101010101010101010101"
in binary. Or 0x555555 in hex.
That means that all the pixel colours are the same. And that will give a BLANK GREY image at best. Not that picture u have up there.
But that picture has pixels with different colours: white, blue and some brown or so.

Now to further expose ur ignorance about how images work, I will have u know that the pixel value is not the only thing that makes up an image.
An image bit stream consists of the pixel value bits, the image name bits, the image dimension value bits, the image encoding bits which determines whether it should be read as png or jpeg, etc.....
There is NO way that image above can have those bit value u posted. The joke is on u.

Advice:
Just keep quiet already. Stop making programmers look bad. I once argued about someone that it takes intelligence to be a programmer. Apparently it doesnt. U are a testimony to that.
With all the knowledge you claim to have above, I want you to show me with some codes how you would take an existing image and use it as texture to fill a 3D or 2D image.

My approach when I first started this thread is still the only way to get around breaking up an existing image and recreating it or working with adding texture to an image the only difference is that it is the 0s and 1s of each pixels of the RGB that should be stored. Here is an example:

"To make a figure like this image, the first thing we have to do is load an image with the texture we want. We want to take a picture file and get it into an array of characters (R1, G1, B1, R2, G2, B2, ...) indicating the color of each pixel in the image. Each component ranges from 0 to 255. Our array will start with the lower-left pixel, then progress to the right end of the row, then move upward to the next column, and so on". http://www.videotutorialsrock.com/opengl_tutorial/textures/text.php

ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Ajibel: Thanks @csharpjava for the link. I'd make effort to learn and see how far I'd go smiley
Cool! Keep me posted on how you get on. This link: http://www.videotutorialsrock.com also has a text version of the 3D programming videos.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
doubleakins: Mr csharp, pls I tried mailing you here but to no avail. pls can you mail me your contact so I can reach you personally. (aakinjiola@gmail.com, 08063777394). want to talk to you regarding learning animations, 3d and cartoons.
regards
Nice to know you're following this thread. I will drop you an email, for now try and follow these video tutorials below which I have been using as well.


https://www.youtube.com/watch?v=zylsMzCHmgA Watch videos 1 to 5


http://www.videotutorialsrock.com
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Ajibel: Okay thanks... I intend diving into game devt sometimes later with blender and the knowledge of 3D would be necessary then. Goodluck and don't give up bro !!
I found a very good video tutorial at this site http://www.videotutorialsrock.com on OpenGL for creating 3D animations and games, the good thing about OpenGL is that there are OpenGL frameworks that allow you to create 3D animations and Games on ASP.Net Winforms and by creating a custom control you can transfer your animations and games to an ASP.Net website. I have attached an image of a 3D game from this OpenGL video tutorial, though the quality has been reduced to 200K to allow it to be displayed on this forum.

Now I can continue with this project based on the research I have done so far. For those who are still interested OpenGL is in C++, and for C# programmers there are .Net frameworks for OpenGL the one I would like to try first is OpenGL4Net, follow this link http://www.opengl.org/wiki/Language_bindings to see all the languages that has an OpenGL framework.

For programmers here who are reluctant about joining this project, I can understand your reason, but the good thing for those who join me, is that they'll be working remotely for my Limited software engineering company based in the UK, this will open up a lot of opportunities for those who can contribute their skills.

ProgrammingRe: Game Development: Next Gen 3d PC Game Team by csharpjava(m): 10:34am On Oct 19, 2013
[quote author=d-hammer]Whats the engine[/quote]I would recommend "Csharpjava 3D" which is still in development https://www.nairaland.com/1458405/animation-creation-3d-join-team
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 10:06pm On Oct 15, 2013
Ajibel: Meanwhile @csharppython,,, errm I went thro' the links you provided earlier, ah swear with the blood of python,, I kinda found it difficult to grasp some stuffs doe I only spent few hours of the weekend,,, just thinking how it'd be to start from ground up so as to catch up fast with the nitty-gritties and piippeess-yiippees !!
I'm taking a break for now in the Garden looking for the fruit of 3D Knowledge to help for when I come back to resume this 3D Animation project This your python will be very useful at this time to help me find this fruit of 3D knowledge. Anyway don't worry because when I resume this project all these codes for creating 3D will become like ABC for you.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 8:01pm On Oct 13, 2013
Elvisten10: @Csharpjava, whats our next move ?
For now try and study the materials at this link http://blogs.msdn.com/b/davrous/archive/2013/06/13/tutorial-series-learning-how-to-write-a-3d-soft-engine-from-scratch-in-c-typescript-or-javascript.aspx
it shows you how to create 3D images with JavaScript or C# this should keep you busy for now. All work and no play you know the rest of the story, so I need to take a break for now, but I'll be back!
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 12:43am On Oct 13, 2013
Kennyinusa: Lets even say that you have completed the engine, i doubt it that you have the money to make it commercial, i even thought that it would go outside of the shores of Nairaland.com because you don't seems to have the money ($100k for a pretty mini startup).
I return to sender one billion to one centillion times
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Elvisten10: @csharpjava, i believe you can achieve this, even if mistakely we don't, we go home with bags of knowledge and experience. But am really concerned for you because i want this project to suceed. Forget about how phenom approached you, just read his posts as if they are from someone you like, grab what he is talking about and think about/analyse it, if you feel they don't matter and you can pull this off without them, then throw them away and continue this project. I know you must have done some home work before you started this, so am not doubting you. You have the energy to achieve this, please just understand me here am not forcing any thing on you. ENOUGH OF THE TALK @ALL, LETS NOW FOCUS ON THE JOB.
True talk but phenom will have to change his way of approach and only contribute what is relevant to this project.

I started this project though I knew a lot of guys here will doubt that it can be done, I did not know everything I now know about the work I have done so far when I first started this project, but I had the believe it can be done if we work as a team and do our research well.

I have followed most of the programming challenges here and solutions provided to some problems asked and I was confident before starting this project that if we all contribute our part to this project one day we'll have a successfully game's engine that can compete with likes of Unity and being able to write a game's engine will make writing complex games easy for us.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
worldbest: Well, @PhenomenonVFX's This is his project, you can give suggestions but don't tell him to stop because he doesn't understand how images are represented in memory.
But I'm still not sure why this guy @PhenomenonVFX's believes he alone knows how images our represented in memory, these are basic stuff, but taking and existing image and breaking it down into 0s and 1s like I did earlier, then recreating other images from these 0s and 1s and converting them into animations is the real stuff. I can lecture this guy @PhenomenonVFX's on how images and even Barcodes are stored in memory but that is not the purpose of the project. This project is about turning theory in practical. These theories have all been built into the language I'm using for this project so why should I try to re-invent the wheel when I have all I need to work with in this project.

I challenge PhenomenonVFX's to start building his own 3D games engine and lets see which one will be the better one.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
For those following be rest assured that this project is not yet over until it's over.

csharpjava: http://msdn.microsoft.com/en-us/library/ms752082.aspx

myPCamera.Position = new Point3D(0, 0, 2);
myPCamera.LookDirection = new Vector3D(0, 0, -1);
myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61);
myNormalCollection.Add(new Vector3D(0,0,1));
myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
This diagram helps to explain how to work out these 3D co-ordinates in some of the sections of the 3D C# code above, which I posted earlier. You can watch the full video on YouTube

@
https://www.youtube.com/watch?v=zylsMzCHmgA

ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 6:51am On Oct 12, 2013
Elvisten10: you didn't understand that guy at all.
You and your guys should start using your time and resources for making useful contributions to this thread, like the 3D C# code I posted above, use your time to analyse it if you can and share the knowledge here rather than looking for how to turn this thread into a useless argument of who has the theoretical knowledge of creating a game's engine. This thread is about turning the theory we have in your heads into into a working solution we can see and use. We are not talking about football here where the spectators are the better players than the actual players on the pitch.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 6:08am On Oct 12, 2013
PhenomenonVFX: My point was actually learn and stop trying to impress. I can see u are still trying hard to impress people on a faceless forum by throwing around words like "publishing" and "journal". Ur goal should be learning and not impressing. If ur goal is learning, and if u meet a setback during the project, u wont feel ashamed to come back here and ask for help from even people that have less experience in programming than u. But if ur goal is impressing people, u could just go and compile someone else's program that u dont understand its inner working and then post the picture here to impress people.
I'm not here to impress anyone, but to lay the foundation for developing a games engine like the best ones around or even better, which in turn will lead to being able to create advance games and I'm confident that this can be achieved.

The 3D C# code I posted above has been provided by Microsoft for learning purposes and I did reference the source of the code so I don't know what I have done wrong by posting such a code here.

You've been trying to prove here that you have all the theoretical knowledge needed for creating images and a game's engine, my advice for you now is that since you are not interest in joining this team, you should use your knowledge, the time, energy and resources you're been wasting for your write-ups on this thread, to start creating your own games engine. But if you have not yet got to that level of turning theory into practical then try and learn from the valuable knowledge transfer I have been sharing on this thread.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 7:48am On Oct 11, 2013
PhenomenonVFX: Advice:
Try to do this because u want to achieve something sensible for urself and not because u want to impress some "doubting Thomases". Because if u are doing it to impress people, there is a high tendency for u to go and copy someone's source code that even u dont understand its inner workings, compile it and show us an image here.
But if u really want to do something, forget the doubting Thomases and impressing people. Learning and acquiring knowledge while doing the project should be ur focus.
Cheers.
Can you show me a Book or Journal you have written to back up your advice on a games engine creation. There is nothing wrong with using standard classes provided by a programming language and knowledge from other sources as long as they are referenced.

I'm conducting a research while working on this project and at the end I can publish a Journal or a book on this project and the research I have carried out.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Javanian: @csharpjava please keep updating us. i am really learning from this.
@all those discouraging him, even if he is wasting his time, is it your time? let him be joor sad
Thanks for this comment , much appreciated.

I have created a graphical user interface to get me the co-ordinates of the pixle points on the screen when I scroll my mouse over, this will be needed when I load images on the screen to be manupulated and for motion co-ordination of these images.

Over to the doubting Thomases are you still doubting.

ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 6:42am On Oct 10, 2013
worldbest: @OP keep doing what you are doing.
Thanks for this encouragement. I won't allow those who don't believe it can be done here, to discourage me as I know it was some people that did such for the very first time and others too did so after.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Still marching forward, now with the codes I will post below I can change the colour of an individual pixel in an image, slice portions of an image by selecting its pixels to create new ones and with the class I posted above, adding some modifications, I can create 3D images with animation. Next stage is to build the user interface for the games engine that will use these standard classes, methods and others including delegates provided by the programming language to draw new images, manupulate existing images and to co-ordinate the movement of these images on the screen.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op): 9:00pm On Oct 07, 2013
worldbest: If you really want to write a game engine, why waste time working with just standard classes of C# or Java. I suggest you just start working with DirectX or OpenGL. Unless you want to learn the low level workings of those frameworks
Thanks for sharing this, is just for now I really love the low level stuff as everything else are built on it. Later on I might move to the ones you suggested.
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Javanian: @csharpjava this looks like using standard libraries to manipulate attributes of an image(3D) like size, position and orientation. I don't see how this would help build a graphics engine undecided I maybe wrong though.
Developing a graphics engine would still require the use of standard classes, unless you're suggesting I write my own programming language, imagine what the doubting Thomases here would say if I should say I want to venture into writing my own programming language grin
ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Ajibel: I'm not fantastic. If there is a rating of Excellent, Average, Poor,,, i'd rate myself below Poor in 3d graphics buh i'm a bit comfortable drawing 2d graphics. Done that with Turtle, JS, HTML5, CSS3, Pygame buh graphics was boring to me then. I'd only participate to learn few things to see if my interest would be fired up, i wont be committed doe embarassed i have a lot doing nau angry angry
Since your are more interested in 3D graphics then here is the C# code which I have just found, will be nice if we can all analyse it together so we can share our understanding.

http://msdn.microsoft.com/en-us/library/ms752082.aspx

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace SDKSample
{
public partial class Basic3DShapeExample : Page
{
public Basic3DShapeExample()
{

// Declare scene objects.
Viewport3D myViewport3D = new Viewport3D();
Model3DGroup myModel3DGroup = new Model3DGroup();
GeometryModel3D myGeometryModel = new GeometryModel3D();
ModelVisual3D myModelVisual3D = new ModelVisual3D();
// Defines the camera used to view the 3D object. In order to view the 3D object,
// the camera must be positioned and pointed such that the object is within view
// of the camera.
PerspectiveCamera myPCamera = new PerspectiveCamera();

// Specify where in the 3D scene the camera is.
myPCamera.Position = new Point3D(0, 0, 2);

// Specify the direction that the camera is pointing.
myPCamera.LookDirection = new Vector3D(0, 0, -1);

// Define camera's horizontal field of view in degrees.
myPCamera.FieldOfView = 60;

// Asign the camera to the viewport
myViewport3D.Camera = myPCamera;
// Define the lights cast in the scene. Without light, the 3D object cannot
// be seen. Note: to illuminate an object from additional directions, create
// additional lights.
DirectionalLight myDirectionalLight = new DirectionalLight();
myDirectionalLight.Color = Colors.White;
myDirectionalLight.Direction = new Vector3D(-0.61, -0.5, -0.61);

myModel3DGroup.Children.Add(myDirectionalLight);

// The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
// is created.
MeshGeometry3D myMeshGeometry3D = new MeshGeometry3D();

// Create a collection of normal vectors for the MeshGeometry3D.
Vector3DCollection myNormalCollection = new Vector3DCollection();
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myNormalCollection.Add(new Vector3D(0,0,1));
myMeshGeometry3D.Normals = myNormalCollection;

// Create a collection of vertex positions for the MeshGeometry3D.
Point3DCollection myPositionCollection = new Point3DCollection();
myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, -0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(-0.5, 0.5, 0.5));
myPositionCollection.Add(new Point3D(-0.5, -0.5, 0.5));
myMeshGeometry3D.Positions = myPositionCollection;

// Create a collection of texture coordinates for the MeshGeometry3D.
PointCollection myTextureCoordinatesCollection = new PointCollection();
myTextureCoordinatesCollection.Add(new Point(0, 0));
myTextureCoordinatesCollection.Add(new Point(1, 0));
myTextureCoordinatesCollection.Add(new Point(1, 1));
myTextureCoordinatesCollection.Add(new Point(1, 1));
myTextureCoordinatesCollection.Add(new Point(0, 1));
myTextureCoordinatesCollection.Add(new Point(0, 0));
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection;

// Create a collection of triangle indices for the MeshGeometry3D.
Int32Collection myTriangleIndicesCollection = new Int32Collection();
myTriangleIndicesCollection.Add(0);
myTriangleIndicesCollection.Add(1);
myTriangleIndicesCollection.Add(2);
myTriangleIndicesCollection.Add(3);
myTriangleIndicesCollection.Add(4);
myTriangleIndicesCollection.Add(5);
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection;

// Apply the mesh to the geometry model.
myGeometryModel.Geometry = myMeshGeometry3D;

// The material specifies the material applied to the 3D object. In this sample a
// linear gradient covers the surface of the 3D object.

// Create a horizontal linear gradient with four stops.
LinearGradientBrush myHorizontalGradient = new LinearGradientBrush();
myHorizontalGradient.StartPoint = new Point(0, 0.5);
myHorizontalGradient.EndPoint = new Point(1, 0.5);
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Yellow, 0.0));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Red, 0.25));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.Blue, 0.75));
myHorizontalGradient.GradientStops.Add(new GradientStop(Colors.LimeGreen, 1.0));

// Define material and apply to the mesh geometries.
DiffuseMaterial myMaterial = new DiffuseMaterial(myHorizontalGradient);
myGeometryModel.Material = myMaterial;

// Apply a transform to the object. In this sample, a rotation transform is applied,
// rendering the 3D object rotated.
RotateTransform3D myRotateTransform3D = new RotateTransform3D();
AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
myAxisAngleRotation3d.Axis = new Vector3D(0,3,0);
myAxisAngleRotation3d.Angle = 40;
myRotateTransform3D.Rotation = myAxisAngleRotation3d;
myGeometryModel.Transform = myRotateTransform3D;

// Add the geometry model to the model group.
myModel3DGroup.Children.Add(myGeometryModel);

// Add the group of models to the ModelVisual3d.
myModelVisual3D.Content = myModel3DGroup;

//
myViewport3D.Children.Add(myModelVisual3D);

// Apply the viewport to the page so it will be rendered.
this.Content = myViewport3D;
}
}
}
And this is the 3D image you get below. Next stage will be to make this 3D image to keep rotating.

ProgrammingRe: 3D Animation Programming Join The Team by csharpjava(op):
Javanian: I am willing to learn as the project goes on. I have no experience on this. Also, i have some knowledge of 3D Maths and 3D Physics, but its just theory.
In that case here is where it all begins if you are programming in Java:

Java Graphics: This code will draw a 2D box which can move across the screen.
If you want I can explain it to you line by line.
https://www.nairaland.com/667409/java-cafe#8322842
csharpjava: The code should look like this:

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class MovingBox extends JFrame implements ActionListener
{

private boolean isRight = true;
private JButton MoveLeftButton = new JButton("Moving Box Right"wink;
private JButton MoveRightButton = new JButton("Moving Box Left"wink;

public MovingBox()
{
       
     setTitle("Moving Box"wink;
setLayout(new FlowLayout());
add(MoveLeftButton);
add(MoveRightButton);
setSize(500,200);
setLocation(300,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MoveRightButton.addActionListener(this);
MoveLeftButton.addActionListener(this);
getContentPane().setBackground(Color.yellow);
setVisible(true);
    }
   
public void paint(Graphics g)
{
super.paint(g);

if(isRight == true)
{
g.drawRect(100,100,90,90);
g.setColor(Color.blue);
g.fillRect(100,100,90,90);
   

}
else
{
g.drawRect(300,100,90,90);
g.setColor(Color.blue);
g.fillRect(300,100,90,90);;
     

}
}

public void actionPerformed(ActionEvent e)
{
if(e.getSource() == MoveRightButton)
{
isRight = true;
repaint();
}

if(e.getSource() == MoveLeftButton)
{
isRight = false;
repaint();
}
}
}
public class runMovingBox {

public static void main(String[] args) {

new MovingBox();
}
}
To move the box across the screen with the keyboard key press add these modifications suggested below:
https://www.nairaland.com/667409/java-cafe#8323511
Shimao: csharpjava has addressed some of it but it could still be better.
Declare the initial position of your box and its dimension as variables, so also the distance to move with each key press.
Use these as arguments to draw the box.
I believe you intend to use a KeyListener, in your event handling code, use a switch to check which key was pressed and increment or decrement the initial x or y position as it would apply, then repaint.
Your class need not implement an event handling interface as you may be giving it unintended responsibility.

1 2 3 4 5 6 7 8 9 10 (of 12 pages)